loplugin:flatten in l10ntools..lotuswordpro
Change-Id: Ie6de142db1987094fdf538148ac5ee33379a3e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
1d21a51d81
commit
968b64d054
@ -394,28 +394,28 @@ XMLFile::XMLFile( const XMLFile& rObj )
|
||||
|
||||
XMLFile& XMLFile::operator=(const XMLFile& rObj)
|
||||
{
|
||||
if( this != &rObj )
|
||||
if( this == &rObj )
|
||||
return *this;
|
||||
|
||||
XMLParentNode::operator=(rObj);
|
||||
|
||||
m_aNodes_localize = rObj.m_aNodes_localize;
|
||||
m_vOrder = rObj.m_vOrder;
|
||||
|
||||
m_pXMLStrings.reset();
|
||||
|
||||
if( rObj.m_pXMLStrings )
|
||||
{
|
||||
XMLParentNode::operator=(rObj);
|
||||
|
||||
m_aNodes_localize = rObj.m_aNodes_localize;
|
||||
m_vOrder = rObj.m_vOrder;
|
||||
|
||||
m_pXMLStrings.reset();
|
||||
|
||||
if( rObj.m_pXMLStrings )
|
||||
m_pXMLStrings.reset( new XMLHashMap );
|
||||
for (auto const& pos : *rObj.m_pXMLStrings)
|
||||
{
|
||||
m_pXMLStrings.reset( new XMLHashMap );
|
||||
for (auto const& pos : *rObj.m_pXMLStrings)
|
||||
LangHashMap* pElem=pos.second;
|
||||
LangHashMap* pNewelem = new LangHashMap;
|
||||
for (auto const& pos2 : *pElem)
|
||||
{
|
||||
LangHashMap* pElem=pos.second;
|
||||
LangHashMap* pNewelem = new LangHashMap;
|
||||
for (auto const& pos2 : *pElem)
|
||||
{
|
||||
(*pNewelem)[ pos2.first ] = new XMLElement( *pos2.second );
|
||||
}
|
||||
(*m_pXMLStrings)[ pos.first ] = pNewelem;
|
||||
(*pNewelem)[ pos2.first ] = new XMLElement( *pos2.second );
|
||||
}
|
||||
(*m_pXMLStrings)[ pos.first ] = pNewelem;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
|
@ -409,36 +409,36 @@ gboolean LOKDocViewSigHandlers::configureEvent(GtkWidget* pWidget, GdkEventConfi
|
||||
}
|
||||
|
||||
LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
|
||||
if (pDocument && pDocument->pClass->getDocumentType(pDocument) == LOK_DOCTYPE_SPREADSHEET)
|
||||
{
|
||||
GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
|
||||
int rowSizePixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment);
|
||||
int rowPosPixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nPositionPixel = gtk_adjustment_get_value(pVAdjustment);
|
||||
GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
|
||||
int colSizePixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment);
|
||||
int colPosPixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nPositionPixel = gtk_adjustment_get_value(pHAdjustment);
|
||||
if (!pDocument || pDocument->pClass->getDocumentType(pDocument) != LOK_DOCTYPE_SPREADSHEET)
|
||||
return true;
|
||||
|
||||
std::stringstream aCommand;
|
||||
aCommand << ".uno:ViewRowColumnHeaders";
|
||||
aCommand << "?x=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colPosPixel));
|
||||
aCommand << "&width=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colSizePixel));
|
||||
aCommand << "&y=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowPosPixel));
|
||||
aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowSizePixel));
|
||||
std::stringstream ss;
|
||||
ss << "lok::Document::getCommandValues(" << aCommand.str() << ")";
|
||||
g_info("%s", ss.str().c_str());
|
||||
char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str());
|
||||
g_info("lok::Document::getCommandValues() returned '%s'", pValues);
|
||||
std::stringstream aStream(pValues);
|
||||
free(pValues);
|
||||
assert(!aStream.str().empty());
|
||||
boost::property_tree::ptree aTree;
|
||||
boost::property_tree::read_json(aStream, aTree);
|
||||
GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
|
||||
int rowSizePixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nSizePixel = gtk_adjustment_get_page_size(pVAdjustment);
|
||||
int rowPosPixel = GTV_CALC_HEADER_BAR(window->rowbar)->m_nPositionPixel = gtk_adjustment_get_value(pVAdjustment);
|
||||
GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(window->scrolledwindow));
|
||||
int colSizePixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nSizePixel = gtk_adjustment_get_page_size(pHAdjustment);
|
||||
int colPosPixel = GTV_CALC_HEADER_BAR(window->columnbar)->m_nPositionPixel = gtk_adjustment_get_value(pHAdjustment);
|
||||
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->rowbar), &aTree.get_child("rows"));
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->columnbar), &aTree.get_child("columns"));
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->cornerarea), nullptr);
|
||||
}
|
||||
std::stringstream aCommand;
|
||||
aCommand << ".uno:ViewRowColumnHeaders";
|
||||
aCommand << "?x=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colPosPixel));
|
||||
aCommand << "&width=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), colSizePixel));
|
||||
aCommand << "&y=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowPosPixel));
|
||||
aCommand << "&height=" << int(lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(window->lokdocview), rowSizePixel));
|
||||
std::stringstream ss;
|
||||
ss << "lok::Document::getCommandValues(" << aCommand.str() << ")";
|
||||
g_info("%s", ss.str().c_str());
|
||||
char* pValues = pDocument->pClass->getCommandValues(pDocument, aCommand.str().c_str());
|
||||
g_info("lok::Document::getCommandValues() returned '%s'", pValues);
|
||||
std::stringstream aStream(pValues);
|
||||
free(pValues);
|
||||
assert(!aStream.str().empty());
|
||||
boost::property_tree::ptree aTree;
|
||||
boost::property_tree::read_json(aStream, aTree);
|
||||
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->rowbar), &aTree.get_child("rows"));
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->columnbar), &aTree.get_child("columns"));
|
||||
gtv_calc_header_bar_configure(GTV_CALC_HEADER_BAR(window->cornerarea), nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -555,30 +555,28 @@ handleGraphicSelectionOnButtonRelease(LOKDocView* pDocView, GdkEventButton* pEve
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->m_bInDragGraphicSelection)
|
||||
if (!priv->m_bInDragGraphicSelection)
|
||||
return false;
|
||||
|
||||
g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
|
||||
priv->m_bInDragGraphicSelection = false;
|
||||
|
||||
GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
|
||||
g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
if (error != nullptr)
|
||||
{
|
||||
g_info("LOKDocView_Impl::signalButton: end of drag graphic selection");
|
||||
priv->m_bInDragGraphicSelection = false;
|
||||
|
||||
GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
|
||||
LOEvent* pLOEvent = new LOEvent(LOK_SET_GRAPHIC_SELECTION);
|
||||
pLOEvent->m_nSetGraphicSelectionType = LOK_SETGRAPHICSELECTION_END;
|
||||
pLOEvent->m_nSetGraphicSelectionX = pixelToTwip(pEvent->x, priv->m_fZoom);
|
||||
pLOEvent->m_nSetGraphicSelectionY = pixelToTwip(pEvent->y, priv->m_fZoom);
|
||||
g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
|
||||
|
||||
g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
|
||||
if (error != nullptr)
|
||||
{
|
||||
g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
g_clear_error(&error);
|
||||
}
|
||||
g_object_unref(task);
|
||||
|
||||
return true;
|
||||
g_warning("Unable to call LOK_SET_GRAPHIC_SELECTION: %s", error->message);
|
||||
g_clear_error(&error);
|
||||
}
|
||||
g_object_unref(task);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -568,26 +568,25 @@ bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageTyp
|
||||
CapType capitalType(const OUString& aTerm, CharClass const * pCC)
|
||||
{
|
||||
sal_Int32 tlen = aTerm.getLength();
|
||||
if (pCC && tlen)
|
||||
if (!pCC || !tlen)
|
||||
return CapType::UNKNOWN;
|
||||
|
||||
sal_Int32 nc = 0;
|
||||
for (sal_Int32 tindex = 0; tindex < tlen; ++tindex)
|
||||
{
|
||||
sal_Int32 nc = 0;
|
||||
for (sal_Int32 tindex = 0; tindex < tlen; ++tindex)
|
||||
{
|
||||
if (pCC->getCharacterType(aTerm,tindex) &
|
||||
css::i18n::KCharacterType::UPPER) nc++;
|
||||
}
|
||||
|
||||
if (nc == 0)
|
||||
return CapType::NOCAP;
|
||||
if (nc == tlen)
|
||||
return CapType::ALLCAP;
|
||||
if ((nc == 1) && (pCC->getCharacterType(aTerm,0) &
|
||||
css::i18n::KCharacterType::UPPER))
|
||||
return CapType::INITCAP;
|
||||
|
||||
return CapType::MIXED;
|
||||
if (pCC->getCharacterType(aTerm,tindex) &
|
||||
css::i18n::KCharacterType::UPPER) nc++;
|
||||
}
|
||||
return CapType::UNKNOWN;
|
||||
|
||||
if (nc == 0)
|
||||
return CapType::NOCAP;
|
||||
if (nc == tlen)
|
||||
return CapType::ALLCAP;
|
||||
if ((nc == 1) && (pCC->getCharacterType(aTerm,0) &
|
||||
css::i18n::KCharacterType::UPPER))
|
||||
return CapType::INITCAP;
|
||||
|
||||
return CapType::MIXED;
|
||||
}
|
||||
|
||||
// sorted(!) array of unicode ranges for code points that are exclusively(!) used as numbers
|
||||
|
@ -713,30 +713,29 @@ bool LwpFrame::IsLeftWider()
|
||||
{
|
||||
rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
|
||||
LwpVirtualLayout* pParent = xLayout.get();
|
||||
if (pParent)
|
||||
if (!pParent)
|
||||
return false;
|
||||
LwpPoint aPoint = m_pLayout->GetOrigin();
|
||||
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
|
||||
double fWidth = m_pLayout->GetWidth();
|
||||
double fWrapLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
|
||||
double fWrapRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
|
||||
|
||||
//LwpPoint aParentPoint = pParent->GetOrigin();
|
||||
//double fParentXOffset = LwpTools::ConvertFromUnitsToMetric(aParentPoint.GetX());
|
||||
double fParentWidth = pParent->GetWidth();
|
||||
if (pParent->IsCell())
|
||||
{
|
||||
LwpPoint aPoint = m_pLayout->GetOrigin();
|
||||
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
|
||||
double fWidth = m_pLayout->GetWidth();
|
||||
double fWrapLeft = m_pLayout->GetExtMarginsValue(MARGIN_LEFT);
|
||||
double fWrapRight = m_pLayout->GetExtMarginsValue(MARGIN_RIGHT);
|
||||
|
||||
//LwpPoint aParentPoint = pParent->GetOrigin();
|
||||
//double fParentXOffset = LwpTools::ConvertFromUnitsToMetric(aParentPoint.GetX());
|
||||
double fParentWidth = pParent->GetWidth();
|
||||
if (pParent->IsCell())
|
||||
{
|
||||
//Get actual width of this cell layout
|
||||
fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
|
||||
}
|
||||
double fParentMarginLeft = pParent->GetMarginsValue(MARGIN_LEFT);
|
||||
double fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
|
||||
|
||||
double fLeft = fXOffset - fWrapLeft - fParentMarginLeft;
|
||||
double fRight = fParentWidth - fParentMarginRight - (fXOffset + fWidth + fWrapRight);
|
||||
if (fLeft > fRight)
|
||||
return true;
|
||||
//Get actual width of this cell layout
|
||||
fParentWidth = static_cast<LwpCellLayout*>(pParent)->GetActualWidth();
|
||||
}
|
||||
double fParentMarginLeft = pParent->GetMarginsValue(MARGIN_LEFT);
|
||||
double fParentMarginRight = pParent->GetMarginsValue(MARGIN_RIGHT);
|
||||
|
||||
double fLeft = fXOffset - fWrapLeft - fParentMarginLeft;
|
||||
double fRight = fParentWidth - fParentMarginRight - (fXOffset + fWidth + fWrapRight);
|
||||
if (fLeft > fRight)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1862,49 +1862,46 @@ LwpShadow* LwpLayout::GetShadow()
|
||||
XFShadow* LwpLayout::GetXFShadow()
|
||||
{
|
||||
LwpShadow* pShadow = GetShadow();
|
||||
if (pShadow)
|
||||
if (!pShadow)
|
||||
return nullptr;
|
||||
LwpColor color = pShadow->GetColor();
|
||||
double offsetX = pShadow->GetOffsetX();
|
||||
double offsetY = pShadow->GetOffsetY();
|
||||
|
||||
if (!offsetX || !offsetY || !color.IsValidColor())
|
||||
return nullptr;
|
||||
XFShadow* pXFShadow = new XFShadow();
|
||||
enumXFShadowPos eXFShadowPos = enumXFShadowLeftTop;
|
||||
double fOffset = 0;
|
||||
|
||||
bool left = false;
|
||||
bool top = false;
|
||||
if (offsetX < 0)
|
||||
left = true;
|
||||
if (offsetY < 0)
|
||||
top = true;
|
||||
if (left)
|
||||
{
|
||||
LwpColor color = pShadow->GetColor();
|
||||
double offsetX = pShadow->GetOffsetX();
|
||||
double offsetY = pShadow->GetOffsetY();
|
||||
|
||||
if (offsetX && offsetY && color.IsValidColor())
|
||||
{
|
||||
XFShadow* pXFShadow = new XFShadow();
|
||||
enumXFShadowPos eXFShadowPos = enumXFShadowLeftTop;
|
||||
double fOffset = 0;
|
||||
|
||||
bool left = false;
|
||||
bool top = false;
|
||||
if (offsetX < 0)
|
||||
left = true;
|
||||
if (offsetY < 0)
|
||||
top = true;
|
||||
if (left)
|
||||
{
|
||||
fOffset = -offsetX;
|
||||
if (top)
|
||||
eXFShadowPos = enumXFShadowLeftTop;
|
||||
else
|
||||
eXFShadowPos = enumXFShadowLeftBottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
fOffset = offsetX;
|
||||
if (top)
|
||||
eXFShadowPos = enumXFShadowRightTop;
|
||||
else
|
||||
eXFShadowPos = enumXFShadowRightBottom;
|
||||
}
|
||||
|
||||
pXFShadow->SetPosition(eXFShadowPos);
|
||||
pXFShadow->SetOffset(fOffset);
|
||||
pXFShadow->SetColor(XFColor(color.To24Color()));
|
||||
|
||||
return pXFShadow;
|
||||
}
|
||||
fOffset = -offsetX;
|
||||
if (top)
|
||||
eXFShadowPos = enumXFShadowLeftTop;
|
||||
else
|
||||
eXFShadowPos = enumXFShadowLeftBottom;
|
||||
}
|
||||
return nullptr;
|
||||
else
|
||||
{
|
||||
fOffset = offsetX;
|
||||
if (top)
|
||||
eXFShadowPos = enumXFShadowRightTop;
|
||||
else
|
||||
eXFShadowPos = enumXFShadowRightBottom;
|
||||
}
|
||||
|
||||
pXFShadow->SetPosition(eXFShadowPos);
|
||||
pXFShadow->SetOffset(fOffset);
|
||||
pXFShadow->SetColor(XFColor(color.To24Color()));
|
||||
|
||||
return pXFShadow;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -545,28 +545,27 @@ LwpFooterLayout* LwpPageLayout::GetFooterLayout()
|
||||
*/
|
||||
LwpPageLayout* LwpPageLayout::GetOddChildLayout()
|
||||
{
|
||||
if (IsComplex())
|
||||
if (!IsComplex())
|
||||
return nullptr;
|
||||
rtl::Reference<LwpVirtualLayout> xLay(
|
||||
dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
|
||||
o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
|
||||
while (xLay.is())
|
||||
{
|
||||
rtl::Reference<LwpVirtualLayout> xLay(
|
||||
dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
|
||||
o3tl::sorted_vector<LwpVirtualLayout*> aSeen;
|
||||
while (xLay.is())
|
||||
{
|
||||
bool bAlreadySeen = !aSeen.insert(xLay.get()).second;
|
||||
if (bAlreadySeen)
|
||||
throw std::runtime_error("loop in conversion");
|
||||
bool bAlreadySeen = !aSeen.insert(xLay.get()).second;
|
||||
if (bAlreadySeen)
|
||||
throw std::runtime_error("loop in conversion");
|
||||
|
||||
if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
|
||||
if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
|
||||
{
|
||||
LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
|
||||
LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
|
||||
if (pUseWhen && pUseWhen->IsUseOnAllOddPages())
|
||||
{
|
||||
LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
|
||||
LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
|
||||
if (pUseWhen && pUseWhen->IsUseOnAllOddPages())
|
||||
{
|
||||
return pPageLayout;
|
||||
}
|
||||
return pPageLayout;
|
||||
}
|
||||
xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
|
||||
}
|
||||
xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user