Compare commits

..

10 Commits

8 changed files with 47 additions and 39 deletions

View File

@ -149,7 +149,7 @@ namespace NSCSS
case NSCSS::Millimeter:
return dValue * 0.01764;
case NSCSS::Inch:
return dValue * 1440.;
return dValue / 1440.;
case NSCSS::Peak:
return dValue * 0.004167; // 0.004167 = 6 / 1440
default:

View File

@ -1237,7 +1237,7 @@ namespace MetaFile
// Вычисление минимально возможной ширины пера
// # Код явялется дублированным из Graphics
const double dSqrtDet = sqrt(abs(oMatrix.Determinant()));
const double dSqrtDet = sqrt(fabs(oMatrix.Determinant()));
const double dWidthMinSize = (dSqrtDet != 0) ? (1.0 / dSqrtDet) : dWidth;
if (0 == pPen->GetWidth())

View File

@ -270,7 +270,6 @@ struct CTextSettings
bool bMergeText; // Объединять подяр идущий текст в 1?
int nLi; // Уровень списка
bool bNumberingLi; // Является ли список нумерованным
bool bWritedLi; // Записан ли уже w:numPr
std::wstring sPStyle;
@ -284,12 +283,12 @@ struct CTextSettings
NSCSS::CCompiledStyle oAdditionalStyle;
CTextSettings()
: bBdo(false), bPre(false), bQ(false), bAddSpaces(true), bMergeText(false), nLi(-1), bNumberingLi(false), bWritedLi(false), eTextMode(Normal)
: bBdo(false), bPre(false), bQ(false), bAddSpaces(true), bMergeText(false), nLi(-1), bNumberingLi(false), eTextMode(Normal)
{}
CTextSettings(const CTextSettings& oTS) :
bBdo(oTS.bBdo), bPre(oTS.bPre), bQ(oTS.bQ), bAddSpaces(oTS.bAddSpaces), bMergeText(oTS.bMergeText),
nLi(oTS.nLi), bNumberingLi(oTS.bNumberingLi), bWritedLi(oTS.bWritedLi), sPStyle(oTS.sPStyle), eTextMode(oTS.eTextMode)
nLi(oTS.nLi), bNumberingLi(oTS.bNumberingLi), sPStyle(oTS.sPStyle), eTextMode(oTS.eTextMode)
{}
void AddPStyle(const std::wstring& wsStyle)
@ -3913,19 +3912,14 @@ private:
bool ReadListElement(NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& arSelectors, CTextSettings& oTS)
{
if (0 > oTS.nLi)
{
CTextSettings oTSLi;
oTSLi.nLi = 0;
oTSLi.oAdditionalStyle.m_oMargin.SetLeft(360., NSCSS::UnitMeasure::Twips, 0, true);
if (OpenP(oXml))
wrP(oXml, arSelectors, oTSLi);
}
else if (OpenP(oXml))
if (OpenP(oXml))
wrP(oXml, arSelectors, oTS);
return readStream(oXml, arSelectors, oTS);
const bool bResult{readStream(oXml, arSelectors, oTS)};
CloseP(oXml, arSelectors);
return bResult;
}
bool ReadList(NSStringUtils::CStringBuilder* oXml, std::vector<NSCSS::CNode>& arSelectors, CTextSettings& oTS)
@ -3981,20 +3975,13 @@ private:
oTSList.oAdditionalStyle.m_oMargin.SetTop (100, NSCSS::UnitMeasure::Twips, 0, true);
oTSList.oAdditionalStyle.m_oMargin.SetBottom(100, NSCSS::UnitMeasure::Twips, 0, true);
oTSLi.bWritedLi = true;
int nDeath = m_oLightReader.GetDepth();
while(m_oLightReader.ReadNextSiblingNode2(nDeath))
{
const std::wstring wsName = m_oLightReader.GetName();
if (L"li" == wsName)
{
if (OpenP(oXml))
wrP(oXml, arSelectors, oTSList);
ReadListElement(oXml, arSelectors, oTSLi);
}
ReadListElement(oXml, arSelectors, oTSList);
else
{
CloseP(oXml, arSelectors);
@ -4083,7 +4070,6 @@ private:
m_oLightReader.MoveToElement();
oTSLiP.nLi++;
oTSLiP.bWritedLi = false;
if (!wsValue.empty())
{
@ -4558,18 +4544,8 @@ private:
}
if (oTS.nLi >= 0)
{
if (!oTS.bWritedLi)
{
oXml->WriteString(L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(oTS.nLi) + L"\"/><w:numId w:val=\"" +
(!oTS.bNumberingLi ? L"1" : std::to_wstring(m_nNumberingId)) + L"\"/></w:numPr>");
oTS.bWritedLi = true;
}
else if (sSelectors.back().m_pCompiledStyle->m_oText.GetIndent().Empty() &&
oTS.oAdditionalStyle.m_oText.GetIndent().Empty())
oXml->WriteString(L"<w:ind w:left=\"" + std::to_wstring(720 * (oTS.nLi + 1)) + L"\"/>");
}
oXml->WriteString(L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(oTS.nLi) + L"\"/><w:numId w:val=\"" +
(!oTS.bNumberingLi ? L"1" : std::to_wstring(m_nNumberingId)) + L"\"/></w:numPr>");
oXml->WriteString(oTS.sPStyle + sPSettings);
oXml->WriteNodeEnd(L"w:pPr");

View File

@ -2554,6 +2554,13 @@ void xlsx_drawing_context::serialize_bitmap_fill(std::wostream & stream, _drawin
CP_XML_ATTR(L"thresh", *fill.biLevel * 1000);
}
}
if (fill.color.opacity > 0.00001)
{
CP_XML_NODE(L"a:alphaModFix")
{
CP_XML_ATTR(L"amt", (int)(fill.color.opacity * 100000));
}
}
}
CP_XML_NODE(L"a:srcRect")

View File

@ -94,6 +94,8 @@ namespace StarMath
if(pReader->GetAttribute() != nullptr && !CheckForLeftArgument(pReader->GetGlobalType()))
pElement->SetBaseAttribute(pReader->GetAttribute());
else if(pReader->GetAttribute() != nullptr && pElement->GetBaseType() == TypeElement::Index && dynamic_cast<CElementIndex*>(pElement)->GetType() == TypeElement::sqrt)
pElement->SetBaseAttribute(pReader->GetAttribute());
else if(pReader->GetAttribute() != nullptr && (pReader->GetLocalType() == TypeElement::plus || TypeElement::minus == pReader->GetLocalType() || TypeElement::frac == pReader->GetLocalType() || TypeElement::neg == pReader->GetLocalType()))
pElement->SetBaseAttribute(pReader->GetAttribute());
pReader->ClearReader();
@ -2610,6 +2612,8 @@ namespace StarMath
m_pLeftArg->SetBaseAttribute(pAttribute);
this->SetBaseAttribute(m_pLeftArg->GetAttribute());
}
if(m_enTypeIndex == TypeElement::sqrt)
this->SetBaseAttribute(pAttribute);
if(m_pValueIndex != nullptr)
m_pValueIndex->SetAttribute(pAttribute);
if(m_pLeftArg != nullptr)

View File

@ -2199,14 +2199,21 @@ BYTE* CPdfReader::GetAPAnnots(int nRasterW, int nRasterH, int nBackgroundColor,
}
if (oAnnot.dictLookup("Subtype", &oObj)->isName())
sType = oObj.getName();
oObj.free(); oAnnot.free();
oObj.free();
if (sType == "Widget")
{
oAnnotRef.free();
oAnnotRef.free(); oAnnot.free();
continue;
}
if (oAnnot.dictLookupNF("IRT", &oObj)->isRef())
{
oObj.free(); oAnnotRef.free(); oAnnot.free();
continue;
}
oAnnot.free(); oObj.free();
PdfReader::CAnnotAP* pAP = new PdfReader::CAnnotAP(pDoc, m_pFontManager, pFontList, nRasterW, nRasterH, nBackgroundColor, nPageIndex, sView, &oAnnotRef, nStartRefID);
if (pAP)
pAP->ToWASM(oRes);

View File

@ -3095,6 +3095,7 @@ CAnnotMarkup::CAnnotMarkup(PDFDoc* pdfDoc, Object* oAnnotRef, int nPageIndex, in
if (oAnnot.dictLookupNF("IRT", &oObj)->isRef())
{
m_unFlags |= (1 << 5);
m_unAFlags &= ~(1 << 6); // IRT аннотации не отображаются
m_unRefNumIRT = oObj.getRefNum() + nStartRefID;
}
oObj.free();

View File

@ -1662,6 +1662,7 @@ void Annot::drawText(GString *text, GString *da, int quadding, double margin,
void Annot::draw(Gfx *gfx, GBool printing) {
GBool oc, isLink;
Object annotObj, oIRTObj;
// check the flags
if ((flags & annotFlagHidden) ||
@ -1670,6 +1671,18 @@ void Annot::draw(Gfx *gfx, GBool printing) {
return;
}
if (!getObject(&annotObj)->isDict()) {
annotObj.free();
return;
}
if (annotObj.dictLookupNF("IRT", &oIRTObj)->isRef()) {
annotObj.free(); oIRTObj.free();
return;
}
annotObj.free(); oIRTObj.free();
// check the optional content entry
if (doc->getOptionalContent()->evalOCObject(&ocObj, &oc) && !oc) {
return;