20 #include <com/sun/star/table/BorderLineStyle.hpp>
44 #include <compiler.hxx>
46 #include <document.hxx>
48 #include <globstr.hrc>
50 #include <inputwin.hxx>
58 #include <stlpool.hxx>
60 #include <tokenarray.hxx>
69 sal_uInt32 nFuncs =
SC_MOD()->GetAppOptions().GetStatusFunc();
74 for ( sal_uInt16 nFunc = 0; nFunc < 32; nFunc++ )
76 if ( !(nFuncs & (1 << nFunc)) )
81 nErrCode = FormulaError::NONE;
83 if (nErrCode != FormulaError::NONE)
89 const char* pGlobStrId =
nullptr;
124 sal_uInt32 nNumFmt = 0;
143 rFuncStr +=
"; " + aStr;
147 return !rFuncStr.isEmpty();
168 bool bOle = GetViewFrame()->GetFrame().IsInPlace();
179 case FID_CHG_COMMENT:
181 ScDocShell* pDocSh = GetViewData().GetDocShell();
188 case SID_OPENDLG_EDIT_PRINTAREA:
189 case SID_ADD_PRINTAREA:
190 case SID_DEFINE_PRINTAREA:
199 case SID_DELETE_PRINTAREA:
208 case SID_STATUS_PAGESTYLE:
210 GetViewData().GetDocShell()->GetStatePageStyle( rSet, nTab );
213 case SID_SEARCH_ITEM:
222 case SID_SEARCH_OPTIONS:
228 if (GetViewData().GetDocShell()->
IsReadOnly())
229 nOptions &= ~
SearchOptionFlags( SearchOptionFlags::REPLACE | SearchOptionFlags::REPLACE_ALL );
234 case SID_CURRENTCELL:
236 ScAddress aScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), 0 );
240 rSet.
Put( aPosItem );
246 rSet.
Put(
SfxUInt16Item( nWhich, static_cast<sal_uInt16>(GetViewData().GetTabNo()) + 1 ) );
253 case FID_TOGGLEINPUTLINE:
255 sal_uInt16
nId = ScInputWindowWrapper::GetChildWindowId();
267 case FID_DEL_MANUALBREAKS:
272 case FID_RESET_PRINTZOOM:
279 SfxStyleFamily::Page );
280 OSL_ENSURE( pStyleSheet,
"PageStyle not found" );
286 if ( nScale == 100 && nPages == 0 )
294 const Fraction& rZoomY = GetViewData().GetZoomY();
302 const Fraction& rZoomY = GetViewData().GetZoomY();
315 const Fraction& rOldY = GetViewData().GetZoomY();
316 sal_uInt16 nZoom =
static_cast<sal_uInt16
>(
tools::Long( rOldY * 100 ));
321 case SID_ATTR_ZOOMSLIDER:
327 const Fraction& rOldY = GetViewData().GetZoomY();
328 sal_uInt16 nCurrentZoom =
static_cast<sal_uInt16
>(
tools::Long( rOldY * 100 ));
334 rSet.
Put( aZoomSliderItem );
340 case FID_FUNCTION_BOX:
348 case FID_TOGGLESYNTAX:
352 case FID_TOGGLEHEADERS:
356 case FID_TOGGLEFORMULA:
364 case FID_NORMALVIEWMODE:
365 case FID_PAGEBREAKMODE:
374 rSet.
Put(
SfxBoolItem(FID_NORMALVIEWMODE, !GetViewData().IsPagebreakMode()));
375 rSet.
Put(
SfxBoolItem(FID_PAGEBREAKMODE, GetViewData().IsPagebreakMode()));
379 case FID_PROTECT_DOC:
392 case FID_PROTECT_TABLE:
405 case SID_AUTO_OUTLINE:
407 if (rDoc.
GetChangeTrack()!=
nullptr || GetViewData().IsMultiMarked())
414 case SID_OUTLINE_DELETEALL:
416 SCTAB nOlTab = GetViewData().GetTabNo();
418 if (pOlTable ==
nullptr)
423 case SID_WINDOW_SPLIT:
444 case SID_WINDOW_FIX_COL:
445 case SID_WINDOW_FIX_ROW:
447 bool bIsCol = (nWhich == SID_WINDOW_FIX_COL);
483 case SID_PRINTPREVIEW:
488 case SID_READONLY_MODE:
492 case FID_TAB_DESELECTALL:
493 if ( nTabSelCount == 1 )
504 ScDocument& rDoc = GetViewData().GetDocument();
506 std::shared_ptr<SvxBoxItem> aLineOuter(std::make_shared<SvxBoxItem>(
ATTR_BORDER));
507 std::shared_ptr<SvxBoxInfoItem> aLineInner(std::make_shared<SvxBoxInfoItem>(
ATTR_BORDER_INNER));
511 auto pOldSet = std::make_shared<SfxItemSet>(pOldAttrs->
GetItemSet());
512 std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
516 pOldSet->MergeRange(SID_ATTR_BORDER_STYLES, SID_ATTR_BORDER_DEFAULT_WIDTH);
519 const std::vector<sal_Int32> aBorderStyles{
520 table::BorderLineStyle::SOLID,
521 table::BorderLineStyle::DOTTED,
522 table::BorderLineStyle::DASHED,
523 table::BorderLineStyle::FINE_DASHED,
524 table::BorderLineStyle::DASH_DOT,
525 table::BorderLineStyle::DASH_DOT_DOT,
526 table::BorderLineStyle::DOUBLE_THIN };
529 pOldSet->Put(aBorderStylesItem);
532 SfxInt64Item aBorderWidthItem(SID_ATTR_BORDER_DEFAULT_WIDTH, 75);
533 pOldSet->Put(aBorderWidthItem);
536 GetSelectionFrame( aLineOuter, aLineInner );
541 std::unique_ptr<SvxBoxItem> aNewFrame(aLineOuter->Clone());
542 std::unique_ptr<SvxBoxInfoItem> aTempInfo(aLineInner->Clone());
544 if ( aLineInner->IsValid(SvxBoxInfoItemValidFlags::LEFT) )
545 aNewFrame->SetLine( aLineOuter->GetLeft(), SvxBoxItemLine::RIGHT );
546 if ( aLineInner->IsValid(SvxBoxInfoItemValidFlags::RIGHT) )
547 aNewFrame->SetLine( aLineOuter->GetRight(), SvxBoxItemLine::LEFT );
549 aLineInner->SetValid( SvxBoxInfoItemValidFlags::LEFT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT));
550 aLineInner->SetValid( SvxBoxInfoItemValidFlags::RIGHT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT));
552 pOldSet->Put( *aNewFrame );
556 pOldSet->Put( *aLineOuter );
559 pOldSet->Put( *aLineInner );
565 pNumberInfoItem = MakeNumberInfoItem(rDoc, GetViewData());
567 pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO );
568 pOldSet->Put(*pNumberInfoItem );
570 bInFormatDialog =
true;
575 if (!rName.isEmpty())
578 auto pRequest = std::make_shared<SfxRequest>(rReq);
581 pDlg->StartExecuteAsync([pDlg, pOldSet, pRequest,
this](sal_Int32 nResult){
582 bInFormatDialog =
false;
589 if(pOutSet->
GetItemState(SID_ATTR_NUMBERFORMAT_INFO,
true,&pItem)==SfxItemState::SET)
591 UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem));
594 ApplyAttributes(pOutSet, pOldSet.get());
596 pRequest->Done(*pOutSet);
616 if ( !pHdl->
GetSelIsRef() && aString.getLength() > 1 &&
617 ( aString[0] ==
'+' || aString[0] ==
'-' ) )
624 std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aString));
625 if ( pArr && pArr->MayReferenceFollow() )
643 if ( !IsRefInputMode() )
675 nEndCol, nEndRow, nEndTab );
681 bool bHideFormula =
false;
682 bool bHideAll =
false;
717 aString =
"'" + aString;
732 pHdl->
NotifyChange( &aState, bForce, pSourceSh, bStopEditing );
735 SfxBindings& rBindings = GetViewFrame()->GetBindings();
744 pHdl->UpdateCellAdjust( eJust );
750 bool bCommitChanges =
true;
754 if (pReqArgs && pReqArgs->
HasItem(FN_PARAM_1, &pItem))
755 bCommitChanges = !static_cast<const SfxBoolItem*>(pItem)->GetValue();
760 SC_MOD()->InputEnterHandler();
777 GetViewData().GetDocShell()->GetViewBindings()->Update(SID_DOC_MODIFIED);
781 if ( GetViewData().GetDocShell()->IsDocShared() )
783 GetViewData().GetDocShell()->SetDocumentModified();
787 GetViewData().GetDocShell()->ExecuteSlot( rReq );
792 SfxShell* pDocSh = GetViewData().GetDocShell();
798 if ( nWhich != SID_SAVEDOC || !GetViewData().GetDocShell()->IsDocShared() )
812 SfxBindings& rBindings = GetViewFrame()->GetBindings();
815 sal_uInt16 nSlotId = rReq.
GetSlot();
818 case SID_GRID_VISIBLE:
819 if ( pArgs && pArgs->
GetItemState(nSlotId,
true,&pItem) == SfxItemState::SET )
828 if ( pArgs && pArgs->
GetItemState(nSlotId,
true,&pItem) == SfxItemState::SET )
836 case SID_HELPLINES_MOVE:
837 if ( pArgs && pArgs->
GetItemState(nSlotId,
true,&pItem) == SfxItemState::SET )
845 GetViewData().SetOptions(aViewOptions);
852 const ScViewOptions& rViewOptions = GetViewData().GetOptions();
864 aBool.
SetWhich( SID_HELPLINES_MOVE );
SC_DLLPUBLIC bool IsDocProtected() const
ScMarkData & GetMarkData()
void SetOption(ScViewOption eOpt, bool bNew)
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
ScDocShell * GetDocShell() const
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
SfxChildWindow * GetChildWindow(sal_uInt16)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
virtual const SfxItemSet * GetOutputItemSet() const =0
void GetState(SfxItemSet &rSet)
void UpdateInputHandlerCellAdjust(SvxCellHorJustify eJust)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(175)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
SCCOLROW GetLOKSheetFreezeIndex(bool bIsCol) const
const SfxItemSet & GetItemSet() const
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
static OUString GetLongErrorString(FormulaError nErrNumber)
ScDocument & GetDocument() const
virtual SfxItemSet & GetItemSet()
This is very similar to ScCellValue, except that it references the original value instead of copying ...
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
EmbeddedObjectRef * pObject
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
void AddSnappingPoint(sal_Int32 nNew)
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
const EditTextObject * mpEditText
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
SCTAB GetSelectCount() const
bool IsMultiMarked() const
SfxFrame & GetFrame() const
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
ScFormulaCell * mpFormula
void ExecDrawOpt(const SfxRequest &rReq)
bool GetFunction(OUString &rFuncStr, FormulaError nErrCode)
ScSplitMode GetHSplitMode() const
void SetCloseBrackets(bool bVal)
bool IsPrintEntireSheet(SCTAB nTab) const
Returns true, if the specified sheet is always printed.
ScChangeTrack * GetChangeTrack() const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
void PutInOrder(T &nStart, T &nEnd)
void ExecuteInputDirect()
void ExecuteSave(SfxRequest &rReq)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
void SetGridVisible(bool bSet)
bool GetUseGridSnap() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
virtual VclPtr< SfxAbstractTabDialog > CreateScAttrDlg(weld::Window *pParent, const SfxItemSet *pCellAttrs)=0
bool GetHideFormula() const
void GetDrawOptState(SfxItemSet &rSet)
void ExecuteCellFormatDlg(SfxRequest &rReq, const OString &rTabPage)
ScChangeAction * GetChangeAction(const ScAddress &rPos)
bool HasManualBreaks(SCTAB nTab) const
OUString ScResId(const char *pId)
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
virtual void SetCurPageId(const OString &rName)=0
bool GetOption(ScViewOption eOpt) const
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
void SetGridOptions(const ScGridOptions &rNew)
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
const ScGridOptions & GetGridOptions() const
void SetValue(bool const bTheValue)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
constexpr T & temporary(T &&x)
ScAddress GetCurPos() const
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
bool HasChildWindow(sal_uInt16)
void DisableItem(sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void SetUseGridSnap(bool bSet)
void SetWhich(sal_uInt16 nId)
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
bool KnowsChildWindow(sal_uInt16)
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
const ScViewOptions & GetOptions() const
void SetSelection(bool bNewSelection)
bool GetSelectionFunction(ScSubTotalFunc eFunc, const ScAddress &rCursor, const ScMarkData &rMark, double &rResult)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
bool IsRefInputMode() const
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
void GetSaveState(SfxItemSet &rSet)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(174)
bool GetGridVisible() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
ScSplitMode GetVSplitMode() const
static SC_DLLPUBLIC const SvxSearchItem & GetSearchItem()