summaryrefslogtreecommitdiffstats
path: root/editeng/source/outliner/outliner.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/outliner/outliner.cxx')
-rw-r--r--editeng/source/outliner/outliner.cxx91
1 files changed, 40 insertions, 51 deletions
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index d5e6630cefe4..671ecd017cfd 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -30,7 +30,7 @@
#include <editeng/outliner.hxx>
#include "paralist.hxx"
#include <editeng/outlobj.hxx>
-#include "outleeng.hxx"
+#include <outleeng.hxx>
#include "outlundo.hxx"
#include <editeng/eeitem.hxx>
#include <editeng/editstat.hxx>
@@ -47,6 +47,8 @@
#include <libxml/xmlwriter.h>
#include <sal/log.hxx>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
+#include <o3tl/temporary.hxx>
#include <osl/diagnose.h>
#include <memory>
@@ -122,7 +124,6 @@ void Outliner::ParagraphInserted( sal_Int32 nPara )
pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nPara );
if( pEditEngine->IsInUndo() )
{
- pPara->nFlags = ParaFlag::SETBULLETTEXT;
pPara->bVisible = true;
const SfxInt16Item& rLevel = pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL );
pPara->SetDepth( rLevel.GetValue() );
@@ -359,7 +360,7 @@ sal_Int32 Outliner::GetBulletsNumberingStatus() const
std::optional<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStartPara, sal_Int32 nCount ) const
{
- if ( static_cast<sal_uLong>(nStartPara) + nCount >
+ if ( static_cast<sal_uInt64>(nStartPara) + nCount >
o3tl::make_unsigned(pParaList->GetParagraphCount()) )
nCount = pParaList->GetParagraphCount() - nStartPara;
@@ -381,6 +382,7 @@ std::optional<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStartPa
aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
}
+ xText->ClearPortionInfo(); // tdf#147166 the PortionInfo is unwanted here
OutlinerParaObject aPObj(std::move(xText), std::move(aParagraphDataVector), bIsEditDoc);
aPObj.SetOutlinerMode(GetOutlinerMode());
@@ -426,7 +428,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
// handle empty strings.
while( nIdx>=0 && nIdx<aText.getLength() )
{
- OUString aStr = aText.getToken( 0, '\x0A', nIdx );
+ std::u16string_view aStr = o3tl::getToken(aText, 0, '\x0A', nIdx );
sal_Int16 nCurDepth;
if( nPos )
@@ -443,11 +445,11 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
( GetOutlinerMode() == OutlinerMode::OutlineView ) )
{
// Extract Tabs
- sal_Int32 nTabs = 0;
- while ( ( nTabs < aStr.getLength() ) && ( aStr[nTabs] == '\t' ) )
+ size_t nTabs = 0;
+ while ( ( nTabs < aStr.size() ) && ( aStr[nTabs] == '\t' ) )
nTabs++;
if ( nTabs )
- aStr = aStr.copy(nTabs);
+ aStr = aStr.substr(nTabs);
// Keep depth? (see Outliner::Insert)
if( !(pPara->nFlags & ParaFlag::HOLDDEPTH) )
@@ -455,19 +457,18 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara )
nCurDepth = nTabs-1; //TODO: sal_Int32 -> sal_Int16!
ImplCheckDepth( nCurDepth );
pPara->SetDepth( nCurDepth );
- pPara->nFlags &= ~ParaFlag::HOLDDEPTH;
}
}
if( nPos ) // not with the first paragraph
{
pParaList->Insert( std::unique_ptr<Paragraph>(pPara), nInsPos );
- pEditEngine->InsertParagraph( nInsPos, aStr );
+ pEditEngine->InsertParagraph( nInsPos, OUString(aStr) );
ParagraphInsertedHdl(pPara);
}
else
{
nInsPos--;
- pEditEngine->SetText( nInsPos, aStr );
+ pEditEngine->SetText( nInsPos, OUString(aStr) );
}
ImplInitDepth( nInsPos, nCurDepth, false );
nInsPos++;
@@ -522,8 +523,8 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara )
}
sal_Int32 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart;
- OUString aLevel = comphelper::string::stripStart(aName.subView(nPos), ' ');
- nTabs = aLevel.toInt32();
+ std::u16string_view aLevel = comphelper::string::stripStart(aName.subView(nPos), ' ');
+ nTabs = o3tl::toInt32(aLevel);
if( nTabs )
nTabs--; // Level 0 = "heading 1"
bConverted = true;
@@ -633,7 +634,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend )
pEditEngine->SetUpdateLayout( bUpdate );
}
-OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
if ( !aCalcFieldValueHdl.IsSet() )
return OUString( ' ' );
@@ -649,6 +650,11 @@ OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara,
rpTxtColor = *aFldInfo.GetTextColor();
}
+ if ( aFldInfo.GetFontLineStyle() )
+ {
+ rpFldLineStyle = *aFldInfo.GetFontLineStyle();
+ }
+
if (aFldInfo.GetFieldColor())
rpFldColor = *aFldInfo.GetFieldColor();
else
@@ -663,7 +669,6 @@ void Outliner::SetStyleSheet( sal_Int32 nPara, SfxStyleSheet* pStyle )
if (pPara)
{
pEditEngine->SetStyleSheet( nPara, pStyle );
- pPara->nFlags |= ParaFlag::SETBULLETTEXT;
ImplCheckNumBulletItem( nPara );
}
}
@@ -802,7 +807,6 @@ bool Outliner::Collapse( Paragraph const * pPara )
return true;
}
-
vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
{
const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
@@ -841,16 +845,12 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
}
// Use original scale...
- sal_uInt16 nStretchX, nStretchY;
- GetGlobalCharStretching(nStretchX, nStretchY);
- sal_uInt16 nScale = pFmt->GetBulletRelSize() * nStretchY / 100;
- sal_uLong nScaledLineHeight = aStdFont.GetFontSize().Height();
- nScaledLineHeight *= nScale*10;
- nScaledLineHeight /= 1000;
+ double fFontScaleY = pFmt->GetBulletRelSize() / 100.0 * getScalingParameters().fFontY;
+ double fScaledLineHeight = aStdFont.GetFontSize().Height() * fFontScaleY;
aBulletFont.SetAlignment( ALIGN_BOTTOM );
- aBulletFont.SetFontSize( Size( 0, nScaledLineHeight ) );
+ aBulletFont.SetFontSize(Size(0, basegfx::fround(fScaledLineHeight)));
bool bVertical = IsVertical();
aBulletFont.SetVertical( bVertical );
aBulletFont.SetOrientation( Degree10(bVertical ? (IsTopToBottom() ? 2700 : 900) : 0) );
@@ -888,12 +888,13 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara );
tools::Rectangle aBulletArea( ImpCalcBulletArea( nPara, true, false ) );
- sal_uInt16 nStretchX, nStretchY;
- GetGlobalCharStretching(nStretchX, nStretchY);
- aBulletArea = tools::Rectangle( Point(aBulletArea.Left()*nStretchX/100,
- aBulletArea.Top()),
- Size(aBulletArea.GetWidth()*nStretchX/100,
- aBulletArea.GetHeight()) );
+
+ double fSpacingFactorX = getScalingParameters().fSpacingX;
+
+ tools::Long nStretchBulletX = basegfx::fround<tools::Long>(double(aBulletArea.Left()) * fSpacingFactorX);
+ tools::Long nStretchBulletWidth = basegfx::fround<tools::Long>(double(aBulletArea.GetWidth()) * fSpacingFactorX);
+ aBulletArea = tools::Rectangle(Point(nStretchBulletX, aBulletArea.Top()),
+ Size(nStretchBulletWidth, aBulletArea.GetHeight()) );
Paragraph* pPara = pParaList->GetParagraph( nPara );
const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
@@ -938,18 +939,8 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
{
// Both TopLeft and bottom left is not quite correct,
// since in EditEngine baseline ...
- double nRealOrientation = toRadians(nOrientation);
- double nCos = cos( nRealOrientation );
- double nSin = sin( nRealOrientation );
- Point aRotatedPos;
- // Translation...
- aTextPos -= rOrigin;
- // Rotation...
- aRotatedPos.setX(static_cast<tools::Long>(nCos*aTextPos.X() + nSin*aTextPos.Y()) );
- aRotatedPos.setY(static_cast<tools::Long>(- (nSin*aTextPos.X() - nCos*aTextPos.Y())) );
- aTextPos = aRotatedPos;
- // Translation...
- aTextPos += rOrigin;
+ rOrigin.RotateAround(aTextPos, nOrientation);
+
vcl::Font aRotatedFont( aBulletFont );
aRotatedFont.SetOrientation( nOrientation );
rOutDev.SetFont( aRotatedFont );
@@ -965,7 +956,7 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
if(bStrippingPortions)
{
const vcl::Font& aSvxFont(rOutDev.GetFont());
- std::vector<sal_Int32> aBuf;
+ KernArray aBuf;
rOutDev.GetTextArray( pPara->GetText(), &aBuf );
if(bSymbol)
@@ -975,7 +966,8 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
aTextPos.AdjustY( -(aMetric.GetDescent()) );
}
- DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), aBuf,
+ assert(aBuf.get_factor() == 1);
+ DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), aBuf.get_subunit_array(), {},
aSvxFont, nPara, bRightToLeftPara ? 1 : 0, nullptr, nullptr, false, false, true, nullptr, Color(), Color());
}
else
@@ -1144,12 +1136,12 @@ void Outliner::ImpFilterIndents( sal_Int32 nFirstPara, sal_Int32 nLastPara )
pEditEngine->SetUpdateLayout( bUpdate );
}
-SfxUndoManager& Outliner::GetUndoManager()
+EditUndoManager& Outliner::GetUndoManager()
{
return pEditEngine->GetUndoManager();
}
-SfxUndoManager* Outliner::SetUndoManager(SfxUndoManager* pNew)
+EditUndoManager* Outliner::SetUndoManager(EditUndoManager* pNew)
{
return pEditEngine->SetUndoManager(pNew);
}
@@ -1651,7 +1643,8 @@ void Outliner::StripPortions()
}
void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart,
- sal_Int32 nTextLen, o3tl::span<const sal_Int32> pDXArray,const SvxFont& rFont,
+ sal_Int32 nTextLen, std::span<const sal_Int32> pDXArray,
+ std::span<const sal_Bool> pKashidaArray, const SvxFont& rFont,
sal_Int32 nPara, sal_uInt8 nRightToLeft,
const EEngineData::WrongSpellVector* pWrongSpellVector,
const SvxFieldData* pFieldData,
@@ -1664,7 +1657,7 @@ void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_I
{
if(aDrawPortionHdl.IsSet())
{
- DrawPortionInfo aInfo( rStartPos, rText, nTextStart, nTextLen, rFont, nPara, pDXArray, pWrongSpellVector,
+ DrawPortionInfo aInfo( rStartPos, rText, nTextStart, nTextLen, rFont, nPara, pDXArray, pKashidaArray, pWrongSpellVector,
pFieldData, pLocale, rOverlineColor, rTextLineColor, nRightToLeft, false, 0, bEndOfLine, bEndOfParagraph, bEndOfBullet);
aDrawPortionHdl.Call( &aInfo );
@@ -1677,7 +1670,7 @@ void Outliner::DrawingTab( const Point& rStartPos, tools::Long nWidth, const OUS
{
if(aDrawPortionHdl.IsSet())
{
- DrawPortionInfo aInfo( rStartPos, rChar, 0, rChar.getLength(), rFont, nPara, {}, nullptr,
+ DrawPortionInfo aInfo( rStartPos, rChar, 0, rChar.getLength(), rFont, nPara, {}, {}, nullptr,
nullptr, nullptr, rOverlineColor, rTextLineColor, nRightToLeft, true, nWidth, bEndOfLine, bEndOfParagraph, false);
aDrawPortionHdl.Call( &aInfo );
@@ -1835,8 +1828,6 @@ void Outliner::ImplCalcBulletText( sal_Int32 nPara, bool bRecalcLevel, bool bRec
if (pPara->GetText() != aBulletText)
pPara->SetText( aBulletText );
- pPara->nFlags &= ~ParaFlag::SETBULLETTEXT;
-
if ( bRecalcLevel )
{
sal_Int16 nDepth = pPara->GetDepth();
@@ -1895,8 +1886,6 @@ OUString Outliner::ImplGetBulletText( sal_Int32 nPara )
Paragraph* pPara = pParaList->GetParagraph( nPara );
if (pPara)
{
- // Enable optimization again ...
-// if( pPara->nFlags & ParaFlag::SETBULLETTEXT )
ImplCalcBulletText( nPara, false, false );
aRes = pPara->GetText();
}