36#include <osl/diagnose.h>
38#include <com/sun/star/text/textfield/Type.hpp>
39#include <com/sun/star/document/XDocumentProperties.hpp>
44#include <document.hxx>
49#include <compiler.hxx>
57 const Point& rCellPos,
60 pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
61 aCellPos(rCellPos),pDev(pDevice),
62 nPPTX(nScaleX),
nPPTY(nScaleY),aZoomX(rX),aZoomY(rY),
63 bInPrintTwips(bPrintTwips) {}
68 OUString aRet = rOld.replaceAll(
"_",
"") +
80 else if (nParCount == 1)
82 OUStringBuffer aRet( nParCount * 80 );
83 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
87 aRet.append( rEngine.
GetText( nPar ));
89 return aRet.makeStringAndClear();
95 OUStringBuffer aRet( nParCount * 80 );
96 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
100 aRet.append( rEdit.
GetText( nPar ));
102 return aRet.makeStringAndClear();
125 std::scoped_lock aGuard(
aMutex);
146 SvxURLField aUrlField( rURL, rText, SvxURLFormat::AppDefault);
157 static const struct {
158 sal_uInt16 nAttrType;
159 sal_uInt16 nCharType;
184 if (
rSet.
GetItemState(AttrTypeMap[
i].nAttrType,
false, &pItem) == SfxItemState::SET )
191 std::unique_ptr<EditTextObject> pNew;
197 const EEControlBits nSpellControl = EEControlBits::ONLINESPELLING | EEControlBits::ALLOWBIGOBJS;
198 bool bNewControl = ( (nControl & nSpellControl) != nSpellControl );
216 const SvxFieldData& rFieldData,
const ScDocument* pDoc, std::optional<Color>* ppTextColor, std::optional<FontLineStyle>* ppFldLineStyle )
221 case text::textfield::Type::URL:
228 case SvxURLFormat::AppDefault:
229 case SvxURLFormat::Repr:
232 case SvxURLFormat::Url:
243 *ppTextColor =
SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor;
246 *ppFldLineStyle = FontLineStyle::LINESTYLE_SINGLE;
249 case text::textfield::Type::EXTENDED_TIME:
268 case text::textfield::Type::DOCINFO_TITLE:
311 SvxCellHorJustify::Left )
350 tools::Long nLayoutSign = (bLayoutRTL && !bIsTiledRendering) ? -1 : 1;
401 aStartPos.
AdjustX(nDifX * nLayoutSign );
413 if ( eJust == SvxCellVerJustify::Top ||
414 ( bForceToTop && (
SC_MOD()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) )
429 pDev->SetFont(aFont);
433 pDev->SetMapMode(aMode);
435 if ( nTextHeight > nCellY +
nTopMargin || bForceToTop )
439 if ( eJust == SvxCellVerJustify::Center )
440 nDifY =
nTopMargin + ( nCellY - nTextHeight ) / 2;
449 if ( bLayoutRTL && !bIsTiledRendering )
450 aStartPos.
AdjustX( -(nCellX - 2) );
457 bNeedsObject( false ),
458 bNeedsCellAttr( false )
474 if (eState == SfxItemState::DONTCARE)
476 else if (eState == SfxItemState::SET)
486 if ( *pItem != rEditDefaults.
Get(
nId) )
491 if ( *pItem != rEditDefaults.
Get(
nId) )
500 if ( eFieldState == SfxItemState::DONTCARE || eFieldState == SfxItemState::SET )
506 if ( eConvState == SfxItemState::DONTCARE || eConvState == SfxItemState::SET )
516 bool bDeleteEnginePoolP )
518 pEnginePool( pEnginePoolP ),
519 pDefaults( nullptr ),
520 bDeleteEnginePool( bDeleteEnginePoolP ),
521 bDeleteDefaults( false )
527 pEnginePool( rOrg.bDeleteEnginePool ? rOrg.pEnginePool->
Clone() : rOrg.pEnginePool ),
528 pDefaults( nullptr ),
529 bDeleteEnginePool( rOrg.bDeleteEnginePool ),
530 bDeleteDefaults( false )
541 bool bDeleteEnginePoolP )
578 for ( sal_Int32 j=0; j<nPara; j++ )
664 for ( sal_Int32 j=0; j<nPara; j++ )
671 std::optional<SfxItemSet> pCharItems;
674 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
681 if ( rParaAttribs.
GetItemState( nWhich,
false, &pParaItem ) == SfxItemState::SET )
688 pCharItems->Put( *pParaItem );
695 std::vector<sal_Int32> aPortions;
701 sal_Int32 nStart = 0;
702 for (
const sal_Int32 nEnd : aPortions )
712 if ( aNewCharAttrs.
GetItemState( nWhich,
false, &pItem ) == SfxItemState::SET &&
713 *pItem != aOldCharAttrs.
Get(nWhich) )
718 if ( aNewCharAttrs.
Count() )
727 if ( rParaAttribs.
Count() )
750 if ( pTextObjectPool )
758 auto pEditDefaults = std::make_unique<SfxItemSet>(
GetEmptyItemSet() );
771 OSL_ENSURE( nNo,
"0 is an invalid number !!" );
774 const sal_Int32 coDiff =
'Z' -
'A' +1;
778 nCalc = nNo % coDiff;
782 nNo = sal::static_int_cast<sal_Int32>( nNo - nCalc );
791 OUString aTmpStr(
'0');
796 case css::style::NumberingType::CHARS_UPPER_LETTER:
797 case css::style::NumberingType::CHARS_LOWER_LETTER:
801 case css::style::NumberingType::ROMAN_UPPER:
802 case css::style::NumberingType::ROMAN_LOWER:
809 case css::style::NumberingType::NUMBER_NONE:
818 aTmpStr = OUString::number(nNo);
822 if( css::style::NumberingType::CHARS_UPPER_LETTER ==
eType )
823 aTmpStr = aTmpStr.toAsciiUpperCase();
841 sal_Int32 , sal_Int32 ,
842 std::optional<Color>& , std::optional<Color>& ,
843 std::optional<FontLineStyle>& )
853 case text::textfield::Type::PAGE:
856 case text::textfield::Type::PAGES:
859 case text::textfield::Type::EXTENDED_TIME:
860 case text::textfield::Type::TIME:
864 case text::textfield::Type::DOCINFO_TITLE:
867 case text::textfield::Type::EXTENDED_FILE:
871 case SvxFileFormat::PathFull :
896 SfxItemPool* pTextObjectPool,
bool bDeleteEnginePoolP) :
898 mpDoc(pDoc), bExecuteURL(true)
900 if ( pTextObjectPool )
906 sal_Int32 , sal_Int32 ,
907 std::optional<Color>& rTxtColor, std::optional<Color>& ,
908 std::optional<FontLineStyle>& rFldLineStyle )
935 if ( pTextObjectPool )
void GetPortions(sal_Int32 nPara, std::vector< sal_Int32 > &rList)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
std::unique_ptr< EditTextObject > CreateTextObject()
void SetText(const OUString &rStr)
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
void SetEditTextObjectPool(SfxItemPool *pPool)
EEControlBits GetControlWord() const
sal_Int32 GetParagraphCount() const
void EnableUndo(bool bEnable)
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
bool IsUndoEnabled() const
SfxItemSet GetAttribs(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags=GetAttribsFlags::ALL) const
sal_Int32 GetTextLen() const
void SetRefMapMode(const MapMode &rMapMode)
const SfxItemSet & GetEmptyItemSet() const
void SetControlWord(EEControlBits nWord)
void SetDefaultLanguage(LanguageType eLang)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
virtual void SetParaAttribs(sal_Int32 nPara, const SfxItemSet &rSet)
const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const
virtual sal_Int32 GetParagraphCount() const=0
virtual OUString GetText(sal_Int32 nPara) const=0
virtual bool HasField(sal_Int32 nType=css::text::textfield::Type::UNSPECIFIED) const=0
virtual bool HasOnlineSpellErrors() const=0
virtual bool RemoveCharAttribs(sal_uInt16 nWhich)=0
static INetURLHistory * GetOrCreate()
bool QueryUrl(const INetURLObject &rUrl) const
OUString getDate(const Date &rDate) const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
tools::Long GetScaledRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale) const
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
tools::Long GetNeededSize(SCCOL nCol, SCROW nRow, SCTAB nTab, OutputDevice *pDev, double nPPTX, double nPPTY, const Fraction &rZoomX, const Fraction &rZoomY, bool bWidth, bool bTotalSize=false, bool bInPrintTwips=false)
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
std::unique_ptr< SfxItemSet > pEditAttrs
ScEditAttrTester(ScEditEngineDefaulter *pEng)
void RemoveParaAttribs()
Paragraph attributes that are not defaults are copied to character attributes and all paragraph attri...
void SetText(const OUString &rStr)
ScEditEngineDefaulter(SfxItemPool *pEnginePool, bool bDeleteEnginePool=false)
bDeleteEnginePool: Engine becomes the owner of the pool and deletes it on destruction
void SetDefaults(const SfxItemSet &rDefaults, bool bRememberCopy=true)
Creates a copy of SfxItemSet if bRememberCopy set.
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
void RepeatDefaults()
Re-apply existing defaults if set, same as in SetText, but without EnableUndo/SetUpdateMode.
void SetDefaultItem(const SfxPoolItem &rItem)
Set the item in the default ItemSet which is created if it doesn't exist yet.
virtual ~ScEditEngineDefaulter() override
const SfxItemSet & GetDefaults()
Returns the stored defaults, used to find non-default character attributes.
void SetTextNewDefaults(const EditTextObject &rTextObject, const SfxItemSet &rDefaults, bool bRememberCopy=true)
Current defaults are not applied, new defaults are applied.
static void RemoveCharAttribs(EditTextObject &rEditText, const ScPatternAttr &rAttr)
ScEditUtil(ScDocument *pDocument, SCCOL nX, SCROW nY, SCTAB nZ, const Point &rCellPos, OutputDevice *pDevice, double nScaleX, double nScaleY, const Fraction &rX, const Fraction &rY, bool bPrintTwips=false)
void GetMargins(const ScPatternAttr *pPattern, tools::Long &nLeftMargin, tools::Long &nTopMargin, tools::Long &nRightMargin, tools::Long &BottomMargin) const
static OUString GetCellFieldValue(const SvxFieldData &rFieldData, const ScDocument *pDoc, std::optional< Color > *ppTextColor, std::optional< FontLineStyle > *ppFldLineStyle)
static std::unique_ptr< EditTextObject > CreateURLObjectFromURL(ScDocument &rDoc, const OUString &rURL, const OUString &rText)
static OUString ModifyDelimiters(const OUString &rOld)
tools::Rectangle GetEditArea(const ScPatternAttr *pPattern, bool bForceToTop)
tools::Long GetIndent(const ScPatternAttr *pPattern) const
static OUString GetMultilineString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by new lines (' ').
VclPtr< OutputDevice > pDev
static std::unique_ptr< EditTextObject > Clone(const EditTextObject &rSrc, ScDocument &rDestDoc)
static OUString GetSpaceDelimitedString(const EditEngine &rEngine)
Retrieves string with paragraphs delimited by spaces.
static SC_DLLPUBLIC OUString GetString(const EditTextObject &rEditText, const ScDocument *pDoc)
Retrieves string with paragraphs delimited by new lines (' ').
virtual ~ScEnginePoolHelper()
ScEnginePoolHelper(SfxItemPool *pEnginePool, bool bDeleteEnginePool)
virtual bool FieldClicked(const SvxFieldItem &rField) override
ScFieldEditEngine(ScDocument *pDoc, SfxItemPool *pEnginePool, SfxItemPool *pTextObjectPool=nullptr, bool bDeleteEnginePool=false)
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor, std::optional< FontLineStyle > &rFldLineStyle) override
static LanguageType GetEditDefaultLanguage()
static void OpenURL(const OUString &rURL, const OUString &rTarget, bool bIgnoreSettings=false)
Open the specified URL.
static SC_DLLPUBLIC LanguageType eLnge
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
static ScFieldEditEngine & GetStaticFieldEditEngine()
A static instance of ScFieldEditEngine not capable of resolving document specific fields,...
SCCOL GetColMerge() const
SCROW GetRowMerge() const
ScNoteEditEngine(SfxItemPool *pEnginePool, SfxItemPool *pTextObjectPool)
SfxItemSet & GetItemSet()
static void fillFontOnly(vcl::Font &rFont, const SfxItemSet &rItemSet, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE)
Static helper function to fill a font object from the passed item set.
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
ScTabEditEngine(ScDocument *pDoc)
void Init(const ScPatternAttr &rPattern)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
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
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
OUString GetFormatted(SvNumberFormatter &rFormatter, LanguageType eLanguage) const
virtual sal_Int32 GetClassId() const
const SvxFieldData * GetField() const
sal_Int16 GetRightMargin() const
sal_Int16 GetTopMargin() const
sal_Int16 GetBottomMargin() const
sal_Int16 GetLeftMargin() const
const OUString & GetRepresentation() const
SvxURLFormat GetFormat() const
const OUString & GetURL() const
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
#define EE_TEXTPOS_MAX_COUNT
#define EE_PARA_MAX_COUNT
static OUString lcl_GetDelimitedString(const EditEngine &rEngine, const char c)
static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
static OUString lcl_GetCharStr(sal_Int32 nNo)
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr sal_uInt16 EE_CHAR_START(EE_PARA_END+1)
constexpr sal_uInt16 EE_FEATURE_NOTCONV(EE_FEATURE_LINEBR+1)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
#define SAL_N_ELEMENTS(arr)
tools::Long const nRightMargin
tools::Long const nBottomMargin
tools::Long const nTopMargin
tools::Long const nLeftMargin
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
constexpr OUStringLiteral EMPTY
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
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< ScPatternAttr > ATTR_PATTERN(156)
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< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)