25 #include <rtl/tencinfo.h>
86 #include <section.hxx>
87 #include <lineinfo.hxx>
121 static const Color eSwWW8ColA[] =
130 "ico " << sal_uInt32(nIco) <<
" >= " <<
SAL_N_ELEMENTS(eSwWW8ColA));
146 short nVal = (pS && aRes.
nRemainingData >= 2) ? SVBT16ToInt16(pS) : nDefaultVal;
154 sal_uInt16 nVal = (pS && aRes.
nRemainingData >= 2) ? SVBT16ToUInt16(pS) : nDefaultVal;
169 switch (maSep.wTextFlow)
172 OSL_ENSURE(
false,
"Unknown layout type");
175 meDir=SvxFrameDirection::Horizontal_LR_TB;
178 meDir=SvxFrameDirection::Vertical_RL_TB;
185 meDir=SvxFrameDirection::Vertical_RL_TB;
189 meDir=SvxFrameDirection::Vertical_RL_TB;
193 meDir=SvxFrameDirection::Horizontal_LR_TB;
198 if ((meDir == SvxFrameDirection::Horizontal_LR_TB) && bRTLPgn)
199 meDir = SvxFrameDirection::Horizontal_RL_TB;
204 return meDir == SvxFrameDirection::Vertical_RL_TB || meDir == SvxFrameDirection::Vertical_LR_TB;
228 nTextareaWidth -= rLR.
GetLeft();
232 std::swap(nTextareaHeight, nTextareaWidth);
245 OSL_ENSURE(
false,
"Unknown grid type");
268 bool bSquaredMode =
false;
273 sal_uInt32 nCharWidth=240;
274 for (sal_uInt16 nI = 0; nI < m_xStyles->GetCount(); ++nI)
276 if (m_vColl[nI].m_bValid && m_vColl[nI].m_pFormat &&
277 m_vColl[nI].IsWW8BuiltInDefaultStyle())
281 nCharWidth = rFontHeightItem.
GetHeight();
291 sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
293 nCharWidth += nMain*20;
295 int nFraction = (nCharSpace & 0x00000FFF);
296 nFraction = (nFraction*20)/0xFFF;
297 nCharWidth += nFraction;
300 aGrid.
SetBaseWidth( writer_cast<sal_uInt16>(nCharWidth));
304 if (nLinePitch >= 1 && nLinePitch <= 31680)
306 aGrid.
SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
317 if ( m_pCurrentColl && StyleExists(m_nCurrentColl) )
318 m_vColl[m_nCurrentColl].m_nRelativeJustify = bRel ? 1 : 0;
319 else if ( m_xPlcxMan && m_xPlcxMan->GetPap() )
320 m_xPlcxMan->GetPap()->nRelativeJustify = bRel ? 1 : 0;
325 bool bRet = m_xWwFib->GetFIBVersion() >=
ww::eWW8;
329 if ( m_pCurrentColl && StyleExists(m_nCurrentColl) )
331 sal_Int16 nRelative = m_vColl[m_nCurrentColl].m_nRelativeJustify;
332 if ( nRelative < 0 && m_nCurrentColl )
335 bRet = IsRelativeJustify(m_vColl[m_nCurrentColl].m_nBase, aVisitedStyles);
338 bRet = nRelative > 0;
340 else if ( m_xPlcxMan && m_xPlcxMan->GetPap() )
342 sal_Int16 nRelative = m_xPlcxMan->GetPap()->nRelativeJustify;
346 bRet = IsRelativeJustify(m_nCurrentColl, aVisitedStyles);
349 bRet = nRelative > 0;
358 assert( m_xWwFib->GetFIBVersion() >=
ww::eWW8
359 &&
"pointless to search styles if relative justify is impossible");
361 if ( StyleExists(nColl) )
363 rVisitedStyles.
insert(nColl);
365 sal_Int16 nRelative = m_vColl[nColl].m_nRelativeJustify;
366 if ( nColl == 0 || nRelative >= 0 )
367 bRet = nRelative > 0;
368 else if (rVisitedStyles.
find(m_vColl[nColl].m_nBase) == rVisitedStyles.
end())
369 bRet = IsRelativeJustify(m_vColl[nColl].m_nBase, rVisitedStyles);
378 m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(),
RES_FRAMEDIR);
382 *pData ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB;
385 bool bBiDiSwap = IsRelativeJustify();
389 const bool bParentRTL = IsRightToLeft();
390 bBiDiSwap = (eDir == SvxFrameDirection::Horizontal_RL_TB && !bParentRTL)
391 || (eDir == SvxFrameDirection::Horizontal_LR_TB && bParentRTL);
400 if ( eDir == SvxFrameDirection::Horizontal_LR_TB )
409 if ( eJustify == SvxAdjust::Left )
411 else if ( eJustify == SvxAdjust::Right )
418 if ( m_pCurrentColl && m_xStyles )
419 m_xStyles->mbBidiChanged =
true;
424 sal_uInt32 nNetWidth)
427 const sal_Int16 nCols = rSection.
NoCols();
432 const sal_uInt16 nNetWriterWidth =
writer_cast<sal_uInt16>(nNetWidth);
433 if (nNetWriterWidth == 0)
452 aCol.
Init(nCols, writer_cast<sal_uInt16>(nColSpace), nNetWriterWidth);
459 for (sal_uInt16
i = 0, nIdx = 1;
i < nCols && nIdx < maxIdx;
i++, nIdx+=2 )
466 pCol->
SetWishWidth(writer_cast<sal_uInt16>(nWishWidth));
467 pCol->
SetLeft(writer_cast<sal_uInt16>(nLeft));
468 pCol->
SetRight(writer_cast<sal_uInt16>(nRight));
518 const wwSection &rSection,
bool bIgnoreCols)
547 sal_Int32 nNewMargin = nMSMargin;
560 if (!IsBorder(rSection.
brc))
564 short aSizeArray[5]={0};
565 SetFlyBordersShadow(aSet, rSection.
brc, &aSizeArray[0]);
571 aLR.SetLeft(SetBorderDistance(bFromEdge, aBox, SvxBoxItemLine::LEFT, aLR.
GetLeft()));
572 aLR.SetRight(SetBorderDistance(bFromEdge, aBox, SvxBoxItemLine::RIGHT, aLR.
GetRight()));
573 aUL.SetUpper(SetBorderDistance(bFromEdge, aBox, SvxBoxItemLine::TOP, aUL.GetUpper()));
574 aUL.SetLower(SetBorderDistance(bFromEdge, aBox, SvxBoxItemLine::BOTTOM, aUL.GetLower()));
597 if (!mrReader.m_bVer67 && mrReader.m_xWDop->iGutterPos &&
617 rData.
nSwUp = nWWHTop;
622 rData.
nSwHLo = nWWUp - nWWHTop;
636 rData.
nSwLo = nWWFBot;
640 rData.
nSwFUp = nWWLo - nWWFBot;
678 aHdUL.SetLower( static_cast< sal_uInt16 >(nHdLowerSpace) );
682 pHdFormat->SetFormatAttr(aHdUL);
705 aFtUL.SetUpper( static_cast< sal_uInt16 >(nFtUpperSpace) );
709 pFtFormat->SetFormatAttr(aFtUL);
722 mrReader.m_rDoc.GetUniqueSectionName() );
726 bool bRTLPgn = !maSegments.empty() && maSegments.back().IsBiDi();
728 bRTLPgn ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB,
RES_FRAMEDIR));
730 if (2 == mrReader.m_xWDop->fpc)
732 if (0 == mrReader.m_xWDop->epc)
735 aSection.SetProtectFlag(SectionIsProtected(rSection));
738 mrReader.m_rDoc.InsertSwSection( rMyPaM, aSection,
nullptr, & aSet );
739 OSL_ENSURE(rSection.
mpSection,
"section not inserted!");
744 auto aIter = std::find_if(maSegments.rbegin(), maSegments.rend(),
745 [](
const wwSection& rSegment) {
return rSegment.mpPage !=
nullptr; });
746 if (aIter != maSegments.rend())
747 pPage = aIter->mpPage;
749 OSL_ENSURE(pPage,
"no page outside this section!");
752 pPage = &mrReader.m_rDoc.GetPageDesc(0);
755 OSL_ENSURE(pFormat,
"impossible");
765 if ((nSectionLeft != 0) || (nSectionRight != 0))
782 bool bRestartLnNumPerSection = (1 == rSection.
maSep.
lnc);
790 aInfo.SetRestartEachPage(rSection.
maSep.
lnc == 0);
794 aInfo.SetPosFromLeft(writer_cast<sal_uInt16>(rSection.
maSep.
dxaLnn));
800 aInfo.SetCountBlankLines(
true);
801 aInfo.SetCountInFlys(
false);
804 aInfo.SetNumType( aNumType );
807 m_bNoLnNumYet =
false;
810 if ((0 < rSection.
maSep.
lnnMin) || bRestartLnNumPerSection)
814 = static_cast<const SwFormatLineNumber*>(GetFormatAttr(
RES_LINENUMBER)))
832 , mnVerticalAdjustment(
drawing::TextVerticalAdjust_TOP)
834 , mbHasFootnote(
false)
869 OSL_ENSURE(pSep,
"impossible!");
879 if( txtNode->Len() == 0 )
891 pWkb->
Where() == nTextPos)
895 bool bSuccess = pWkb->
Get(nTest, pData);
912 sal_uInt16 nLIdx = ( (
static_cast<sal_uInt16
>(
mrReader.
m_xWwFib->m_lid) & 0xff ) == 0x9 ) ? 1 : 0;
917 static const sal_uInt16 aVer2Ids0[] =
927 static const sal_uInt16 aVer67Ids0[] =
937 static const sal_uInt16 aVer8Ids0[] =
947 const sal_uInt16* pIds = eVer <=
ww::eWW2 ? aVer2Ids0 : eVer <=
ww::eWW7 ? aVer67Ids0 : aVer8Ids0;
960 aNewSection.maSep.bkc = *pSprmBkc;
964 aNewSection.maSep.fTitlePage =
968 aNewSection.maSep.nfcPgn =
ReadBSprm( pSep, pIds[2], 0 );
969 if (aNewSection.maSep.nfcPgn > 4)
970 aNewSection.maSep.nfcPgn = 0;
979 aNewSection.maSep.ccolM1 =
ReadSprm(pSep, pIds[3], 0 );
987 aNewSection.maSep.dxaColumns =
ReadUSprm( pSep, pIds[4], 708 );
990 aNewSection.maSep.fLBetween =
ReadBSprm(pSep, pIds[5], 0 );
995 aNewSection.maSep.fEvenlySpaced =
998 if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
1000 int nColumnDataIdx = 0;
1001 aNewSection.maSep.rgdxaColumnWidthSpacing[nColumnDataIdx] = 0;
1005 const sal_uInt8 nColumnCount =
static_cast< sal_uInt8 >(aNewSection.maSep.ccolM1 + 1);
1006 for (
sal_uInt8 nColumn = 0; nColumn < nColumnCount; ++nColumn )
1012 OSL_ENSURE( pSW,
"+Sprm 136 (resp. 0xF203) (ColWidth) missing" );
1013 sal_uInt16 nWidth = (pSW && aSWRes.
nRemainingData >= 3) ? SVBT16ToUInt16(pSW + 1) : 1440;
1015 aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
1017 if ( nColumn < nColumnCount - 1 )
1023 OSL_ENSURE( pSD,
"+Sprm 137 (resp. 0xF204) (Colspacing) missing" );
1026 nWidth = SVBT16ToUInt16(pSD + 1);
1027 aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
1034 static const sal_uInt16 aVer2Ids1[] =
1048 static const sal_uInt16 aVer67Ids1[] =
1062 static const sal_uInt16 aVer8Ids1[] =
1076 pIds = eVer <=
ww::eWW2 ? aVer2Ids1 : eVer <=
ww::eWW7 ? aVer67Ids1 : aVer8Ids1;
1079 aNewSection.maSep.dmOrientPage =
ReadBSprm(pSep, pIds[0], 0);
1088 static const sal_uInt16 nLef[] = {
MM_250, 1800 };
1089 static const sal_uInt16 nRig[] = {
MM_250, 1800 };
1091 aNewSection.maSep.dxaLeft =
ReadUSprm( pSep, pIds[3], nLef[nLIdx]);
1092 aNewSection.maSep.dxaRight =
ReadUSprm( pSep, pIds[4], nRig[nLIdx]);
1099 aNewSection.maSep.dmOrientPage == 2)
1100 std::swap(aNewSection.maSep.dxaLeft, aNewSection.maSep.dxaRight);
1102 aNewSection.maSep.dzaGutter =
ReadUSprm( pSep, pIds[5], 0);
1104 aNewSection.maSep.fRTLGutter =
static_cast<sal_uInt8>(
1108 aNewSection.maSep.fPgnRestart =
ReadBSprm(pSep, pIds[6], 0);
1110 aNewSection.maSep.pgnStart =
ReadUSprm( pSep, pIds[7], 0 );
1114 if (
maSegments.empty() && !aNewSection.maSep.fPgnRestart && pSprmBkc && *pSprmBkc == 3 )
1116 aNewSection.maSep.pgnStart = 2;
1117 aNewSection.maSep.fPgnRestart = 1;
1124 aNewSection.maSep.iHeadingPgn = *aRes.
pSprm;
1128 aNewSection.maSep.cnsPgn = *aRes.
pSprm;
1131 aRes = pSep->
HasSprm(pIds[8]);
1134 aNewSection.maSep.dmBinFirst = *pSprmSDmBinFirst;
1136 aRes = pSep->
HasSprm(pIds[9]);
1139 aNewSection.maSep.dmBinOther = *pSprmSDmBinOther;
1141 static const sal_uInt16 nTop[] = {
MM_250, 1440 };
1142 static const sal_uInt16 nBot[] = {
MM_200, 1440 };
1144 static const sal_uInt16 aVer2Ids2[] =
1156 static const sal_uInt16 aVer67Ids2[] =
1167 static const sal_uInt16 aVer8Ids2[] =
1179 pIds = eVer <=
ww::eWW2 ? aVer2Ids2 : eVer <=
ww::eWW7 ? aVer67Ids2 : aVer8Ids2;
1181 aNewSection.maSep.dyaTop =
ReadSprm( pSep, pIds[0], nTop[nLIdx] );
1182 aNewSection.maSep.dyaBottom =
ReadSprm( pSep, pIds[1], nBot[nLIdx] );
1183 aNewSection.maSep.dyaHdrTop =
ReadUSprm( pSep, pIds[2], 720 );
1184 aNewSection.maSep.dyaHdrBottom =
ReadUSprm( pSep, pIds[3], 720 );
1193 aNewSection.maSep.dxtCharSpace = SVBT32ToUInt32(aRes.
pSprm);
1197 aNewSection.maSep.pgbApplyTo = pgbProp & 0x0007;
1198 aNewSection.maSep.pgbPageDepth = (pgbProp & 0x0018) >> 3;
1199 aNewSection.maSep.pgbOffsetFrom = (pgbProp & 0x00E0) >> 5;
1201 aNewSection.mnBorders =
::lcl_ReadBorders(
false, aNewSection.brc,
nullptr,
nullptr, pSep);
1207 aNewSection.maSep.nLnnMod = *aSprmSNLnnMod.
pSprm;
1211 aNewSection.maSep.lnc = *aSprmSLnc.
pSprm;
1215 aNewSection.maSep.dxaLnn = SVBT16ToUInt16(aSprmSDxaLnn.
pSprm);
1219 aNewSection.maSep.lnnMin = *aSprmSLnnMin.
pSprm;
1239 for (
int nI = 0, nMask = 1; nI < 6; ++nI, nMask <<= 1)
1241 if (aNewSection.maSep.grpfIhdt & nMask)
1254 aNewSection.maSep.grpfIhdt &= ~nMask;
1265 aNewSection.SetDirection();
1324 else if (nBrcVer == 8 && nLen >=
sizeof(
WW8_BRC))
1325 rVar =
WW8_BRCVer9(*reinterpret_cast<const WW8_BRC*>(pS));
1330 return nullptr != pS;
1349 a8Sprm[0], a8Sprm[1], a8Sprm[2], a8Sprm[3]))
1351 for(
int i = 0;
i < 4; ++
i )
1352 nBorder |=
int(
SetWW8_BRC(8, brc[
i], a8Sprm[i].pSprm, a8Sprm[i].nRemainingData))<<i;
1360 a9Sprm[0], a9Sprm[1], a9Sprm[2], a9Sprm[3]))
1362 for(
int i = 0;
i < 4; ++
i )
1363 nBorder |=
int(
SetWW8_BRC(9, brc[
i], a9Sprm[i].pSprm, a9Sprm[i].nRemainingData))<<i;
1370 static const sal_uInt16 aVer67Ids[5] = {
1378 static const sal_uInt16 aVer8Ids[5] = {
1386 static const sal_uInt16 aVer9Ids[5] = {
1398 for(
int i = 0;
i < 5; ++
i )
1401 nBorder |=
int(
SetWW8_BRC(6 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1406 for(
int i = 0;
i < 5; ++
i )
1409 nBorder |=
int(
SetWW8_BRC(8 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1412 for(
int i = 0;
i < 5; ++
i )
1415 nBorder |=
int(
SetWW8_BRC(9 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1423 for(
int i = 0;
i < 5; ++
i )
1426 nBorder |=
int(
SetWW8_BRC(6 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1431 for(
int i = 0;
i < 5; ++
i )
1434 nBorder |=
int(
SetWW8_BRC(8 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1437 for(
int i = 0;
i < 5; ++
i )
1440 nBorder |=
int(
SetWW8_BRC(9 , brc[i], aRes.pSprm, aRes.nRemainingData))<<i;
1445 OSL_ENSURE( pSty || pPap,
"WW8PLCFx_Cp_FKP and WW8RStyle "
1446 "and WW8PLCFx_SEPX is 0" );
1454 sal_uInt32 cv,
short nIdx,
SvxBoxItemLine nOOIndex, sal_uInt16 nWWIndex,
1458 if ( nIdx == 0x1A || nIdx == 0x1B )
1460 nIdx = (nIdx == 0x1A) ? 0x12 : 0x11;
1469 double const fConverted( (SvxBorderLineStyle::NONE == eStyle) ? 0.0 :
1479 pSize[nWWIndex] = fConverted + nSpace;
1481 rBox.
SetLine(&aLine, nOOIndex);
1487 sal_uInt16 nWWIndex,
short *pSize,
const bool bIgnoreSpace)
1492 GetLineIndex(rBox, nLineThickness, bIgnoreSpace ? 0 : nSpace,
1493 rBor.
cv(), rBor.
brcType(), nOOIndex, nWWIndex, pSize );
1512 short *pSizeArray,
sal_uInt8 nSetBorders)
1514 bool bChange =
false;
1515 static const std::pair<sal_uInt16, SvxBoxItemLine> aIdArr[] =
1517 {
WW8_TOP, SvxBoxItemLine::TOP },
1518 {
WW8_LEFT, SvxBoxItemLine::LEFT },
1520 {
WW8_BOT, SvxBoxItemLine::BOTTOM },
1521 {
WW8_BETW, SvxBoxItemLine::BOTTOM }
1524 for(
int i = 0;
i < 4; ++
i )
1533 else if ( nSetBorders & (1 << aIdArr[
i].
first) )
1546 rBox.
SetLine(
nullptr, aIdArr[
i ].second );
1565 rShadow.
SetLocation(SvxShadowLocation::BottomRight);
1575 pbrc[ 0 ].dptSpace() * 20,
1576 pbrc[ 3 ].dptSpace() * 20,
1577 pbrc[ 2 ].dptSpace() * 20 );
1583 bool bShadowed =
false;
1589 rFlySet.
Put( aBox );
1596 rFlySet.
Put( aShadow );
1605 #define MAX_BORDER_SIZE 210 // max. size of border
1606 #define MAX_EMPTY_BORDER 10 // for off-by-one errors, at least 1
1621 *pVar =
static_cast<sal_Int16
>(SVBT16ToUInt16(aS.
pSprm));
1622 return aS.
pSprm !=
nullptr;
1629 *pVar =
static_cast<sal_Int16
>(SVBT16ToUInt16(aS.
pSprm));
1630 return aS.
pSprm !=
nullptr;
1686 ((
nSp45 & 0x7fff) == (rSrc.
nSp45 & 0x7fff)) &&
1744 nSp29 = (nOrigSp29 & 0xCF) | 0x20;
1751 std::shared_ptr<WW8PLCFMan> xPlcxMan = pIo->
m_xPlcxMan;
1754 Read(nOrigSp29, pPap);
1765 xPlcxMan->GetPap()->Save( aSave );
1774 if( nText[0] != 0x01 || nText[1] != 0x0d )
1792 sal_uInt16 nColl = pPap->
GetIstd();
1795 ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc(nColl) : static_cast<ww::sti>(nColl);
1796 while (eSti !=
ww::stiNil && static_cast<size_t>(nColl) < pIo->
m_vColl.size() &&
nullptr == (pNowStyleApo = pIo->
m_vColl[nColl].m_xWWFly.get()))
1798 aSeenStyles.
insert(nColl);
1800 nColl = pIo->
m_vColl[nColl].m_nBase;
1802 if (aSeenStyles.
find(nColl) != aSeenStyles.
end())
1804 SAL_WARN(
"sw.ww8",
"loop in style chain");
1808 eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc(nColl) : static_cast<ww::sti>(nColl);
1814 if( !( aF == *
this ) )
1820 xPlcxMan->GetPap()->Restore( aSave );
1821 pIoStrm->
Seek( nPos );
1872 nSp29 = (nOrigSp29 & 0xCF) | 0x20;
1885 OSL_ENSURE(aEmpty.
nSp37 == 2,
"this is not what we expect for nSp37");
1886 if (this->
nSp37 == 0)
1888 return aEmpty == *
this;
1895 const sal_uInt32 nWWPgTop,
1896 const sal_uInt32 nPgWidth,
1897 const sal_Int32 nIniFlyDx,
1898 const sal_Int32 nIniFlyDy ):
1907 nNetWidth(rWW.nSp28),
1909 eHRel(
text::RelOrientation::PAGE_FRAME),
1911 eVAlign(
text::VertOrientation::
NONE),
1912 eHAlign(
text::HoriOrientation::
NONE),
1913 eSurround(( rWW.nSp37 > 1 ) ?
css::
text::WrapTextMode_DYNAMIC :
css::
text::WrapTextMode_NONE),
1914 nXBind(( rWW.nSp29 & 0xc0 ) >> 6),
1915 nYBind(( rWW.nSp29 & 0x30 ) >> 4),
1923 if (bIsTable && rWW.
nSp37 == 2)
1924 eSurround = css::text::WrapTextMode_PARALLEL;
1948 msword_cast<sal_Int16>(nPgWidth ? nPgWidth : 2268);
1970 eVRel = text::RelOrientation::PAGE_PRINT_AREA;
1973 eVRel = text::RelOrientation::PAGE_FRAME;
1984 eVAlign = text::VertOrientation::TOP;
1989 eVAlign = text::VertOrientation::CENTER;
1992 eVAlign = text::VertOrientation::BOTTOM;
1997 nYPos = rWW.
nSp27 +
static_cast<short>(nIniFlyDy);
2004 eHAlign = text::HoriOrientation::LEFT;
2008 eHAlign = text::HoriOrientation::CENTER;
2011 eHAlign = text::HoriOrientation::RIGHT;
2015 eHAlign = text::HoriOrientation::LEFT;
2019 eHAlign = text::HoriOrientation::RIGHT;
2023 nXPos = rWW.
nSp26 +
static_cast<short>(nIniFlyDx);
2031 eHRel = text::RelOrientation::FRAME;
2034 eHRel = text::RelOrientation::PAGE_PRINT_AREA;
2050 sal_Int16 nLeBorderMgn( 0 );
2055 nLeBorderMgn = nLeBorderMgn + nTemp;
2058 sal_Int16 nRiBorderMgn( 0 );
2063 nRiBorderMgn = nRiBorderMgn + nTemp;
2065 if ( !
bAutoWidth &&
eHAlign == text::HoriOrientation::LEFT &&
eHRel == text::RelOrientation::PAGE_FRAME )
2071 eHRel = text::RelOrientation::PAGE_PRINT_AREA;
2076 else if ( !
bAutoWidth &&
eHAlign == text::HoriOrientation::RIGHT &&
eHRel == text::RelOrientation::PAGE_FRAME )
2082 eHRel = text::RelOrientation::PAGE_RIGHT;
2083 nXPos = ( nRiBorderMgn - nLeBorderMgn ) + rWW.
nLeMgn;
2087 else if ( !
bAutoWidth &&
eHAlign == text::HoriOrientation::LEFT &&
eHRel == text::RelOrientation::PAGE_PRINT_AREA )
2092 eHRel = text::RelOrientation::PAGE_PRINT_AREA;
2093 nXPos = -nLeBorderMgn;
2097 else if ( !
bAutoWidth &&
eHAlign == text::HoriOrientation::RIGHT &&
eHRel == text::RelOrientation::PAGE_PRINT_AREA )
2102 eHRel = text::RelOrientation::PAGE_RIGHT;
2115 sal_Int16 nLeLMgn = 0;
2117 nLeLMgn = nLeLMgn + nTemp;
2121 if (
eHAlign == text::HoriOrientation::LEFT)
2132 eVRel = text::RelOrientation::PAGE_FRAME;
2133 nYPos =
static_cast< sal_Int16
>(
nYPos + nWWPgTop );
2179 sal_Int16 eHRel = pFS->
eHRel;
2193 if ( pFS->
eSurround == css::text::WrapTextMode_DYNAMIC )
2197 short aSizeArray[5]={0};
2205 text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ) );
2228 Init(rReader, pPaM);
2232 short aSizeArray[5]={0};
2243 for (
int i = 0;
i < 4;
i++)
2277 : pCtrlStck(pStack),
2278 aChrSet(rDoc.GetAttrPool()),
2279 aParSet(rDoc.GetAttrPool())
2284 for (
size_t i=0;
i < nCnt; ++
i)
2313 }
while ((pItem = aIter.
NextItem()));
2326 OSL_ENSURE( rContent.
GetContentIdx(),
"No content prepared." );
2362 if(aIdx.GetNode().IsTableNode())
2367 if ( (aIdx < aEnd) && aIdx.GetNode().IsTextNode() )
2371 if (aIdx == aEnd && pNd && pNd->
GetText().isEmpty())
2414 OSL_ENSURE(rApo.
HasFrame() || pTabPos,
2415 "If no frame found, *MUST* be in a table");
2423 pRet->ApplyTabPos(pTabPos);
2425 if (pRet->IsEmpty())
2453 short nDCS = SVBT16ToUInt16(aDCS.
pSprm);
2493 if (pTabPos && pTabPos->
bNoFly)
2504 OSL_ENSURE(
m_xSFlyPara->GetFlyFormat()->GetAnchor().GetAnchorId() ==
2514 m_xWWZOrder->InsertTextLayerObject(pOurNewObject);
2580 if (aLastAnchorPos == aToBeJoined)
2588 if (aDropCharPos == aToBeJoined)
2597 if (aOpenApoPos == aToBeJoined)
2650 OSL_ENSURE(
m_xSFlyPara->xMainTextPos,
"StopApo: xMainTextPos is nullptr");
2703 if (aLastAnchorPos == aToBeJoined)
2756 aSize.SetWidth(nNewWidth);
2759 m_xSFlyPara->GetFlyFormat()->SetFormatAttr(aSize);
2782 OSL_ENSURE(
m_xWFlyPara,
" Where is my pWFlyPara ? ");
2802 const bool bFirstLineOfStSet,
2803 const bool bLeftIndentSet )
2825 if ( bFirstLineOfStSet )
2831 if ( bLeftIndentSet )
2944 static_cast< sal_uInt8 >( ( (pData && nLen >= 1) ? *pData : 0 ) );
2954 else if (
m_pPaM !=
nullptr)
2958 static_cast<sal_uInt8>(((pData && nLen >= 1) ? *pData : 0)));
2992 reinterpret_cast<const char*>(pData+2), 1,
2993 RTL_TEXTENCODING_MS_1252).toChar();
3014 const int nContiguousWestern = 8;
3015 const int nWestern = nContiguousWestern + 1;
3016 const int nEastern = 2;
3018 const int nIds = nWestern + nEastern + nCTL;
3019 static const sal_uInt16 nEndIds[ nIds ] =
3038 nI = nContiguousWestern;
3043 nI =
static_cast< sal_uInt8 >(nId - 60);
3050 sal_uInt16 nMask = 1 << nI;
3071 bool bOn = *pData & 1;
3212 static const sal_uInt16 nEndIds[2] =
3220 nI =
static_cast< sal_uInt8 >(nId - 80);
3222 nI =
static_cast< sal_uInt8 >(nId - 111);
3226 OSL_ENSURE(nI <= 1,
"not happening");
3230 sal_uInt16 nMask = 1 << nI;
3238 bool bOn = *pData & 1;
3253 && ( *pData & 0x80 )
3298 OSL_ENSURE(
false,
"Unhandled unknown bidi toggle attribute");
3361 OSL_ENSURE(
false,
"Unhandled unknown toggle attribute");
3367 sal_uInt16 nNewStyle81Mask )
3369 sal_uInt16
i = 1, nToggleAttrFlags =
m_xCtrlStck->GetToggleAttrFlags();
3373 (i & nToggleAttrFlags) &&
3374 ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
3383 sal_uInt16 nNewStyle81Mask )
3385 sal_uInt16
i = 1, nToggleAttrFlags =
m_xCtrlStck->GetToggleBiDiAttrFlags();
3389 (i & nToggleAttrFlags) &&
3390 ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
3443 aBegin == aEnd && nBegin == nEnd - 1 &&
3444 nullptr != (pTNd = aBegin.GetNode().GetTextNode()) &&
3468 bool bIsGraphicPlacementHack =
false;
3482 pFlyFormat->SetFormatAttr(
SwFormatVertOrient(0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::CHAR));
3483 bIsGraphicPlacementHack =
true;
3486 return bIsGraphicPlacementHack;
3493 if (nLen < (eVersion <=
ww::eWW2 ? 1 : 2))
3510 short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToInt16( pData );
3511 sal_Int32 nPos2 = nPos * ( 10 * 100 );
3514 OSL_ENSURE(pF,
"Expected to have the fontheight available here");
3517 sal_Int32 nHeight = 240;
3518 if (pF !=
nullptr && pF->GetHeight() != 0)
3519 nHeight = pF->GetHeight();
3532 bool bWordLine =
false;
3541 case 2: bWordLine =
true;
3592 else if( pData && 6 == nLen )
3599 switch( SVBT16ToUInt16( pData+1 ) )
3601 case 1: cStt =
'('; cEnd =
')';
break;
3602 case 2: cStt =
'['; cEnd =
']';
break;
3603 case 3: cStt =
'<'; cEnd =
'>';
break;
3604 case 4: cStt =
'{'; cEnd =
'}';
break;
3612 bool bFitToLine = 0 != *(pData+1);
3701 if (pUnderlineAttr && nLen >= 4)
3707 OUString& rName,
FontPitch& rePitch, rtl_TextEncoding& reCharSet )
3739 reCharSet = RTL_TEXTENCODING_DONTKNOW;
3741 reCharSet = rtl_getTextEncodingFromWindowsCharset(pF->
aFFNBase.
chs);
3748 if (rName.startsWithIgnoreAsciiCase(
"Tms Rmn") ||
3749 rName.startsWithIgnoreAsciiCase(
"Timmons") ||
3750 rName.startsWithIgnoreAsciiCase(
"CG Times") ||
3751 rName.startsWithIgnoreAsciiCase(
"MS Serif") ||
3752 rName.startsWithIgnoreAsciiCase(
"Garamond") ||
3753 rName.startsWithIgnoreAsciiCase(
"Times Roman") ||
3754 rName.startsWithIgnoreAsciiCase(
"Times New Roman"))
3758 else if (rName.startsWithIgnoreAsciiCase(
"Helv") ||
3759 rName.startsWithIgnoreAsciiCase(
"Arial") ||
3760 rName.startsWithIgnoreAsciiCase(
"Univers") ||
3761 rName.startsWithIgnoreAsciiCase(
"LinePrinter") ||
3762 rName.startsWithIgnoreAsciiCase(
"Lucida Sans") ||
3763 rName.startsWithIgnoreAsciiCase(
"Small Fonts") ||
3764 rName.startsWithIgnoreAsciiCase(
"MS Sans Serif"))
3782 rtl_TextEncoding eSrcCharSet;
3784 if( !
GetFontParams( nFCode, eFamily, aName, ePitch, eSrcCharSet ) )
3799 eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
3812 eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
3821 rtl_TextEncoding eDstCharSet = eSrcCharSet;
3823 SvxFontItem aFont( eFamily, aName, OUString(), ePitch, eDstCharSet, nWhich);
3940 sal_uInt16 nFCode = SVBT16ToUInt16( pData );
3970 if (nLen < (eVersion <=
ww::eWW2 ? 1 : 2))
4020 if (nfChsDiff && nLen >= 2)
4021 m_eHardCharSet = rtl_getTextEncodingFromWindowsCharset( *(pData + 1) );
4052 sal_uInt16
nLang = SVBT16ToUInt16( pData );
4068 sal_uInt16
nId = SVBT16ToUInt16( pData );
4097 sal_Int16 nKern = SVBT16ToUInt16( pData );
4108 sal_Int16 nAutoKern = SVBT16ToUInt16( pData );
4125 aSHD.
SetWWValue( *reinterpret_cast<SVBT16 const *>(pData) );
4132 std::map<OUString, css::uno::Any>& rMap = aGrabBag.
GetGrabBag();
4133 rMap.insert(std::pair<OUString, css::uno::Any>(
"CharShadingMarker",
uno::Any(
true)));
4146 OSL_ENSURE(nLen == 10,
"Len of para back colour not 10!");
4154 std::map<OUString, css::uno::Any>& rMap = aGrabBag.
GetGrabBag();
4155 rMap.insert(std::pair<OUString, css::uno::Any>(
"CharShadingMarker",
uno::Any(
true)));
4222 short nPara = SVBT16ToUInt16( pData );
4224 std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(
RES_LR_SPACE));
4227 aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->
Clone()));
4278 bool bFirstLinOfstSet(
false );
4279 bool bLeftIndentSet(
false );
4287 aLR->SetTextLeft( nPara );
4292 bLeftIndentSet =
true;
4320 aLR->SetTextFirstLineOffset(nPara);
4330 aLR->SetTextLeft(pNumFormat->GetIndentAt());
4334 if ( pDefaultStopItem && pDefaultStopItem->
Count() > 0 )
4335 const_cast<SwNumFormat*>(pNumFormat)->SetListtabPos( const_cast<SvxTabStop&>((*pDefaultStopItem)[0]).GetTabPos() );
4344 bFirstLinOfstSet =
true;
4350 aLR->SetRight( nPara );
4356 NewAttr( *aLR, bFirstLinOfstSet, bLeftIndentSet );
4368 if (nLen < (eVersion <=
ww::eWW2 ? 3 : 4))
4376 short nSpace = SVBT16ToUInt16( pData );
4377 short nMulti = (eVersion <=
ww::eWW2) ? 1 : SVBT16ToUInt16( pData + 2 );
4383 eLnSpc = SvxLineSpaceRule::Fix;
4386 eLnSpc = SvxLineSpaceRule::Min;
4398 sal_uInt16 nSpaceTw = 0;
4410 nSpaceTw = o3tl::narrowing<sal_uInt16>( n * pH->
GetHeight() / 100 );
4415 nSpaceTw = o3tl::narrowing<sal_uInt16>(nSpace);
4427 if (fDontUseHTMLAutoSpacing)
4507 short nPara = SVBT16ToUInt16( pData );
4550 if (!pText || !nPos)
4609 bool bDistributed =
false;
4616 eAdjust = SvxAdjust::Center;
4619 eAdjust = SvxAdjust::Right;
4622 eAdjust = SvxAdjust::Block;
4625 eAdjust = SvxAdjust::Block;
4626 bDistributed =
true;
4644 bRTL = *aDir.
pSprm != 0;
4649 if (pItem && (pItem->GetValue() == SvxFrameDirection::Horizontal_RL_TB))
4670 bool bDistributed =
false;
4677 eAdjust = SvxAdjust::Center;
4680 eAdjust = SvxAdjust::Left;
4683 eAdjust = SvxAdjust::Block;
4686 eAdjust = SvxAdjust::Block;
4687 bDistributed =
true;
4713 OSL_ENSURE(
false,
"wrong Id" );
4721 std::unique_ptr<SfxBoolItem> pI(static_cast<SfxBoolItem*>(
GetDfltAttr( nId )->
Clone()));
4722 pI->SetValue( 0 != *pData );
4754 nVal = FontEmphasisMark::NONE;
4758 nVal = (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove);
4760 nVal = (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove);
4762 nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow);
4765 nVal = (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove);
4768 nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow);
4772 nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow);
4774 nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove);
4777 nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove);
4791 sal_uInt16 nVal = SVBT16ToUInt16( pData );
4793 if (nVal < 1 || nVal > 600)
4815 : FontRelief::NONE );
4816 if( pOld->GetValue() == nNewValue )
4818 if( FontRelief::NONE != nNewValue )
4819 nNewValue = FontRelief::NONE;
4842 bBlink = *pData > 0 && *pData < 7;
4852 OSL_ENSURE(b < 17,
"ww8: colour out of range");
4859 OSL_ENSURE(b < 17,
"ww8: colour out of range");
4867 SetShade(nFore, nBack, b);
4949 Color nUseBack = nBack;
4956 sal_uLong nWW8BrushStyle = eMSGrayScale[nIndex];
4958 switch (nWW8BrushStyle)
4965 Color aForeColor(nFore);
4966 Color aBackColor(nUseBack);
4968 sal_uInt32 nRed = aForeColor.
GetRed() * nWW8BrushStyle;
4969 sal_uInt32 nGreen = aForeColor.
GetGreen() * nWW8BrushStyle;
4970 sal_uInt32 nBlue = aForeColor.
GetBlue() * nWW8BrushStyle;
4971 nRed += aBackColor.
GetRed() * (1000 - nWW8BrushStyle);
4972 nGreen += aBackColor.
GetGreen()* (1000 - nWW8BrushStyle);
4973 nBlue += aBackColor.
GetBlue() * (1000 - nWW8BrushStyle);
4995 aSHD.
SetWWValue( *reinterpret_cast<SVBT16 const *>(pData) );
5013 OSL_ENSURE(nLen == 10,
"Len of para back colour not 10!");