diff options
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 32 | ||||
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx | 60 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 36 | ||||
-rw-r--r-- | linguistic/source/misc.cxx | 33 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpframelayout.cxx | 43 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 77 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 33 |
7 files changed, 153 insertions, 161 deletions
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index d533d8db07ba..10f52fdcb3d7 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -394,28 +394,28 @@ XMLFile::XMLFile( const XMLFile& rObj ) XMLFile& XMLFile::operator=(const XMLFile& rObj) { - if( this != &rObj ) - { - XMLParentNode::operator=(rObj); + if( this == &rObj ) + return *this; - m_aNodes_localize = rObj.m_aNodes_localize; - m_vOrder = rObj.m_vOrder; + XMLParentNode::operator=(rObj); - m_pXMLStrings.reset(); + m_aNodes_localize = rObj.m_aNodes_localize; + m_vOrder = rObj.m_vOrder; - if( rObj.m_pXMLStrings ) + 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; diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx index 90b96e57488a..a2cbd8021dea 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx @@ -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); - - 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); - } + if (!pDocument || pDocument->pClass->getDocumentType(pDocument) != LOK_DOCTYPE_SPREADSHEET) + return true; + + 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); + + 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; } diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 2d7852f3781e..45c9cacedff6 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -555,30 +555,28 @@ handleGraphicSelectionOnButtonRelease(LOKDocView* pDocView, GdkEventButton* pEve } } - if (priv->m_bInDragGraphicSelection) - { - g_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); - priv->m_bInDragGraphicSelection = false; + if (!priv->m_bInDragGraphicSelection) + return 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_info("LOKDocView_Impl::signalButton: end of drag graphic selection"); + priv->m_bInDragGraphicSelection = false; - 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); + 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); - return true; + 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 false; + return true; } static void diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 09635359d1ce..0954c093238a 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -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 (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; + 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; - } - return CapType::UNKNOWN; + return CapType::MIXED; } // sorted(!) array of unicode ranges for code points that are exclusively(!) used as numbers diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index b5c65fc411a3..c0f2e7e720de 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -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; } diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 881b35d8dc48..6405e2277e79 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1862,49 +1862,46 @@ LwpShadow* LwpLayout::GetShadow() XFShadow* LwpLayout::GetXFShadow() { LwpShadow* pShadow = GetShadow(); - if (pShadow) - { - LwpColor color = pShadow->GetColor(); - double offsetX = pShadow->GetOffsetX(); - double offsetY = pShadow->GetOffsetY(); + if (!pShadow) + return nullptr; + 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; - } + 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) + { + 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())); + pXFShadow->SetPosition(eXFShadowPos); + pXFShadow->SetOffset(fOffset); + pXFShadow->SetColor(XFColor(color.To24Color())); - return pXFShadow; - } - } - return nullptr; + return pXFShadow; } /** diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 822d82866de2..69e25d0299bc 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -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; } |