diff options
Diffstat (limited to 'svx/source/svdraw/svdpdf.cxx')
-rw-r--r-- | svx/source/svdraw/svdpdf.cxx | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 8a48e0a9d9be..5c34b510301f 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -146,42 +146,42 @@ void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pAction int nPageIndex) { const int nPageCount = mpPdfDocument->getPageCount(); - if (nPageCount > 0 && nPageIndex >= 0 && nPageIndex < nPageCount) - { - // Render next page. - auto pPdfPage = mpPdfDocument->openPage(nPageIndex); - if (!pPdfPage) - return; + if (!(nPageCount > 0 && nPageIndex >= 0 && nPageIndex < nPageCount)) + return; - basegfx::B2DSize dPageSize = mpPdfDocument->getPageSize(nPageIndex); + // Render next page. + auto pPdfPage = mpPdfDocument->openPage(nPageIndex); + if (!pPdfPage) + return; - const double dPageWidth = dPageSize.getX(); - const double dPageHeight = dPageSize.getY(); + basegfx::B2DSize dPageSize = mpPdfDocument->getPageSize(nPageIndex); - SetupPageScale(dPageWidth, dPageHeight); + const double dPageWidth = dPageSize.getX(); + const double dPageHeight = dPageSize.getY(); - // Load the page text to extract it when we get text elements. - auto pTextPage = pPdfPage->getTextPage(); + SetupPageScale(dPageWidth, dPageHeight); - const int nPageObjectCount = pPdfPage->getObjectCount(); - if (pProgrInfo) - pProgrInfo->SetActionCount(nPageObjectCount); + // Load the page text to extract it when we get text elements. + auto pTextPage = pPdfPage->getTextPage(); - for (int nPageObjectIndex = 0; nPageObjectIndex < nPageObjectCount; ++nPageObjectIndex) + const int nPageObjectCount = pPdfPage->getObjectCount(); + if (pProgrInfo) + pProgrInfo->SetActionCount(nPageObjectCount); + + for (int nPageObjectIndex = 0; nPageObjectIndex < nPageObjectCount; ++nPageObjectIndex) + { + auto pPageObject = pPdfPage->getObject(nPageObjectIndex); + ImportPdfObject(pPageObject, pTextPage, nPageObjectIndex); + if (pProgrInfo && pActionsToReport) { - auto pPageObject = pPdfPage->getObject(nPageObjectIndex); - ImportPdfObject(pPageObject, pTextPage, nPageObjectIndex); - if (pProgrInfo && pActionsToReport) - { - (*pActionsToReport)++; + (*pActionsToReport)++; - if (*pActionsToReport >= 16) - { - if (!pProgrInfo->ReportActions(*pActionsToReport)) - break; + if (*pActionsToReport >= 16) + { + if (!pProgrInfo->ReportActions(*pActionsToReport)) + break; - *pActionsToReport = 0; - } + *pActionsToReport = 0; } } } @@ -392,25 +392,25 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr) mbFntDirty = false; } - if (pObj) - { - pObj->SetLayer(mnLayer); + if (!pObj) + return; - if (bLine) - { - pObj->SetMergedItemSet(*mpLineAttr); - } + pObj->SetLayer(mnLayer); - if (bFill) - { - pObj->SetMergedItemSet(*mpFillAttr); - } + if (bLine) + { + pObj->SetMergedItemSet(*mpLineAttr); + } - if (bText) - { - pObj->SetMergedItemSet(*mpTextAttr); - pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); - } + if (bFill) + { + pObj->SetMergedItemSet(*mpFillAttr); + } + + if (bText) + { + pObj->SetMergedItemSet(*mpTextAttr); + pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); } } @@ -562,63 +562,63 @@ void ImpSdrPdfImport::InsertObj(SdrObject* pObj, bool bScale) } } - if (pObj) + if (!pObj) + return; + + // #i111954# check object for visibility + // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj + bool bVisible(false); + + if (pObj->HasLineStyle()) + { + bVisible = true; + } + + if (!bVisible && pObj->HasFillStyle()) + { + bVisible = true; + } + + if (!bVisible) { - // #i111954# check object for visibility - // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj - bool bVisible(false); + SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj); - if (pObj->HasLineStyle()) + if (pTextObj && pTextObj->HasText()) { bVisible = true; } + } + + if (!bVisible) + { + SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pObj); - if (!bVisible && pObj->HasFillStyle()) + if (pGrafObj) { + // this may be refined to check if the graphic really is visible. It + // is here to ensure that graphic objects without fill, line and text + // get created bVisible = true; } + } - if (!bVisible) - { - SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj); - - if (pTextObj && pTextObj->HasText()) - { - bVisible = true; - } - } + if (!bVisible) + { + SdrObject::Free(pObj); + } + else + { + maTmpList.push_back(pObj); - if (!bVisible) + if (dynamic_cast<SdrPathObj*>(pObj)) { - SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>(pObj); + const bool bClosed(pObj->IsClosedObj()); - if (pGrafObj) - { - // this may be refined to check if the graphic really is visible. It - // is here to ensure that graphic objects without fill, line and text - // get created - bVisible = true; - } - } - - if (!bVisible) - { - SdrObject::Free(pObj); + mbLastObjWasPolyWithoutLine = mbNoLine && bClosed; } else { - maTmpList.push_back(pObj); - - if (dynamic_cast<SdrPathObj*>(pObj)) - { - const bool bClosed(pObj->IsClosedObj()); - - mbLastObjWasPolyWithoutLine = mbNoLine && bClosed; - } - else - { - mbLastObjWasPolyWithoutLine = false; - } + mbLastObjWasPolyWithoutLine = false; } } } |