[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - extras/source sw/source

Caolán McNamara caolanm at redhat.com
Thu Jun 14 20:04:24 UTC 2018


 extras/source/glade/libreoffice-catalog.xml.in |    3 
 sw/source/ui/misc/outline.cxx                  |  212 -------------------------
 sw/source/uibase/inc/numprevw.hxx              |   34 ----
 3 files changed, 249 deletions(-)

New commits:
commit b555f76b9d27d8f7b4d7413650230097bd97025e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 14 13:25:34 2018 +0100

    swuilo-NumberingPreview is now unused
    
    Change-Id: Ieba56962ae1986686ae649ac15ba721a3fbfae5e
    Reviewed-on: https://gerrit.libreoffice.org/55814
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 37e57b1c4c83..6fa17e231fec 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -269,9 +269,6 @@
     <glade-widget-class title="Document Preview Window" name="sdlo-SdDocPreviewWin"
                         generic-name="Document Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="Writer Number Preview" name="swuilo-NumberingPreview"
-                        generic-name="Writer Number Preview Window" parent="GtkDrawingArea"
-                        icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="Background Preview" name="cuilo-BackgroundPreview"
                         generic-name="Background Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index bd66fa969d03..e1d428e23ef8 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -851,213 +851,6 @@ static long lcl_DrawGraphic(vcl::RenderContext* pVDev, const SwNumFormat &rForma
     return nRet;
 }
 
-VCL_BUILDER_FACTORY(NumberingPreview)
-
-// paint numbering's preview
-void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
-{
-    const Size aSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
-
-    ScopedVclPtrInstance<VirtualDevice> pVDev(rRenderContext);
-    pVDev->SetMapMode(rRenderContext.GetMapMode());
-    pVDev->SetOutputSize(aSize);
-
-    // #101524# OJ
-    pVDev->SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
-    pVDev->SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor());
-    pVDev->DrawRect(tools::Rectangle(Point(0,0), aSize));
-
-    if (pActNum)
-    {
-        long nWidthRelation = 30; // chapter dialog
-        if(nPageWidth)
-        {
-            nWidthRelation = nPageWidth / aSize.Width();
-            if(bPosition)
-                nWidthRelation = nWidthRelation * 2 / 3;
-            else
-                nWidthRelation = nWidthRelation / 4;
-        }
-
-        // height per level
-        const long nXStep = aSize.Width() / (3 * MAXLEVEL * ((MAXLEVEL < 10) ? 2 : 1));
-        const long nYStep = (aSize.Height() - 6)/ MAXLEVEL;
-        long nYStart = 4;
-        aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, GetAppLanguage(),
-                                                GetDefaultFontFlags::OnlyOne, &rRenderContext);
-        // #101524# OJ
-        aStdFont.SetColor(SwViewOption::GetFontColor());
-
-        const long nFontHeight = nYStep * ( bPosition ? 15 : 6 ) / 10;
-        aStdFont.SetFontSize(Size( 0, nFontHeight ));
-
-        long nPreNum = pActNum->Get(0).GetStart();
-
-        if (bPosition)
-        {
-            const long nLineHeight = nFontHeight * 8 / 7;
-            sal_uInt8 nStart = 0;
-            while (!(nActLevel & (1 << nStart)))
-            {
-                nStart++;
-            }
-            if(nStart) // so that possible predecessors and successors are showed
-                nStart--;
-
-            SwNumberTree::tNumberVector aNumVector;
-            sal_uInt8 nEnd = std::min(sal_uInt8(nStart + 3), MAXLEVEL);
-            for (sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel)
-            {
-                const SwNumFormat &rFormat = pActNum->Get(nLevel);
-                aNumVector.push_back(rFormat.GetStart());
-
-                long nXStart( 0 );
-                long nTextOffset( 0 );
-                long nNumberXPos( 0 );
-                if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
-                {
-                    nXStart = rFormat.GetAbsLSpace() / nWidthRelation;
-                    nTextOffset = rFormat.GetCharTextDistance() / nWidthRelation;
-                    nNumberXPos = nXStart;
-                    const long nFirstLineOffset = (-rFormat.GetFirstLineOffset()) / nWidthRelation;
-
-                    if(nFirstLineOffset <= nNumberXPos)
-                        nNumberXPos -= nFirstLineOffset;
-                    else
-                        nNumberXPos = 0;
-                }
-                else if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
-                {
-                    const long nTmpNumberXPos((rFormat.GetIndentAt() + rFormat.GetFirstLineIndent()) / nWidthRelation);
-                    nNumberXPos = (nTmpNumberXPos < 0) ? 0 : nTmpNumberXPos;
-                }
-
-                long nBulletWidth = 0;
-                if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
-                {
-                    nBulletWidth = lcl_DrawGraphic(pVDev.get(), rFormat, nNumberXPos,
-                                                   nYStart, nWidthRelation);
-                }
-                else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
-                {
-                    nBulletWidth = lcl_DrawBullet(pVDev.get(), rFormat, nNumberXPos,
-                                                  nYStart, aStdFont.GetFontSize());
-                }
-                else
-                {
-                    pVDev->SetFont(aStdFont);
-                    if(pActNum->IsContinusNum())
-                        aNumVector[nLevel] = nPreNum;
-                    OUString aText(pActNum->MakeNumString( aNumVector ));
-                    pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
-                    nBulletWidth = pVDev->GetTextWidth(aText);
-                    nPreNum++;
-                }
-                if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
-                     rFormat.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
-                {
-                    pVDev->SetFont(aStdFont);
-                    OUString aText(' ');
-                    pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
-                    nBulletWidth += pVDev->GetTextWidth(aText);
-                }
-
-                long nTextXPos(0);
-                if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
-                {
-                    nTextXPos = nXStart;
-                    if (nTextOffset < 0)
-                         nTextXPos = nTextXPos + nTextOffset;
-                    if (nNumberXPos + nBulletWidth + nTextOffset > nTextXPos)
-                        nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
-                }
-                else if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
-                {
-                    switch (rFormat.GetLabelFollowedBy())
-                    {
-                        case SvxNumberFormat::LISTTAB:
-                        {
-                            nTextXPos = rFormat.GetListtabPos() / nWidthRelation;
-                            if (nTextXPos < nNumberXPos + nBulletWidth)
-                            {
-                                nTextXPos = nNumberXPos + nBulletWidth;
-                            }
-                        }
-                        break;
-                        case SvxNumberFormat::SPACE:
-                        case SvxNumberFormat::NOTHING:
-                        case SvxNumberFormat::NEWLINE:
-                        {
-                            nTextXPos = nNumberXPos + nBulletWidth;
-                        }
-                        break;
-                    }
-
-                    nXStart = rFormat.GetIndentAt() / nWidthRelation;
-                }
-
-                tools::Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
-                pVDev->SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); // COL_BLACK );
-                pVDev->DrawRect(aRect1);
-
-                tools::Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2), Size(aSize.Width() / 2, 2));
-                pVDev->DrawRect(aRect2);
-                nYStart += 2 * nLineHeight;
-            }
-        }
-        else
-        {
-            SwNumberTree::tNumberVector aNumVector;
-            const long nLineHeight = nFontHeight * 3 / 2;
-            for (sal_uInt8 nLevel = 0; nLevel < MAXLEVEL; ++nLevel, nYStart = nYStart + nYStep)
-            {
-                const SwNumFormat &rFormat = pActNum->Get(nLevel);
-                aNumVector.push_back(rFormat.GetStart());
-                long nXStart(0);
-                if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
-                {
-                    nXStart = rFormat.GetAbsLSpace() / nWidthRelation;
-                }
-                else if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT)
-                {
-                    const long nTmpXStart((rFormat.GetIndentAt() + rFormat.GetFirstLineIndent() ) / nWidthRelation);
-                    nXStart = (nTmpXStart < 0) ? 0 : nTmpXStart;
-                }
-                nXStart /= 2;
-                nXStart += 2;
-                long nTextOffset;
-                if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
-                {
-                    lcl_DrawGraphic(pVDev.get(), rFormat, nXStart, nYStart, nWidthRelation);
-                    nTextOffset = nLineHeight + nXStep;
-                }
-                else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
-                {
-                    nTextOffset =  lcl_DrawBullet(pVDev.get(), rFormat, nXStart, nYStart, aStdFont.GetFontSize());
-                    nTextOffset += nXStep;
-                }
-                else
-                {
-                    pVDev->SetFont(aStdFont);
-                    if (pActNum->IsContinusNum())
-                        aNumVector[nLevel] = nPreNum;
-                    OUString aText(pActNum->MakeNumString( aNumVector ));
-                    pVDev->DrawText( Point(nXStart, nYStart), aText );
-                    nTextOffset = pVDev->GetTextWidth(aText) + nXStep;
-                    nPreNum++;
-                }
-                pVDev->SetFont(aStdFont);
-                pVDev->DrawText(
-                    Point(nXStart + nTextOffset, nYStart),
-                    (pOutlineNames == nullptr
-                     ? utl::ConfigManager::getProductName()
-                     : pOutlineNames[nLevel]));
-            }
-        }
-    }
-    rRenderContext.DrawOutDev(Point(0,0), aSize, Point(0,0), aSize, *pVDev);
-}
-
 void SwNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
 {
     const Size aSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
@@ -1262,9 +1055,4 @@ void SwNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::
     rRenderContext.DrawOutDev(Point(0,0), aSize, Point(0,0), aSize, *pVDev);
 }
 
-
-NumberingPreview::~NumberingPreview()
-{
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/numprevw.hxx b/sw/source/uibase/inc/numprevw.hxx
index 44aa3ccc5e34..cb8cc0b4dedd 100644
--- a/sw/source/uibase/inc/numprevw.hxx
+++ b/sw/source/uibase/inc/numprevw.hxx
@@ -26,40 +26,6 @@
 class SwNumRule;
 namespace rtl { class OUString; }
 
-class NumberingPreview : public vcl::Window
-{
-    const SwNumRule*    pActNum;
-    vcl::Font           aStdFont;
-    long                nPageWidth;
-    const OUString*     pOutlineNames;
-    bool                bPosition;
-    sal_uInt16          nActLevel;
-
-    protected:
-        virtual void        Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override;
-
-    public:
-        NumberingPreview(vcl::Window* pParent)
-            : Window(pParent)
-            , pActNum(nullptr),nPageWidth(0), pOutlineNames(nullptr),
-            bPosition(false), nActLevel(USHRT_MAX)
-        {
-        }
-
-        virtual ~NumberingPreview() override;
-
-        void    SetNumRule(const SwNumRule* pNum)
-                    {pActNum = pNum; Invalidate();};
-        void    SetPageWidth(long nPgWidth)
-                                {nPageWidth = nPgWidth;}
-        void    SetOutlineNames(const OUString* pNames)
-                        {pOutlineNames = pNames;}
-        void    SetPositionMode()
-                        { bPosition = true;}
-        void    SetLevel(sal_uInt16 nSet) {nActLevel = nSet;}
-
-};
-
 class SwNumberingPreview : public weld::CustomWidgetController
 {
     const SwNumRule*    pActNum;


More information about the Libreoffice-commits mailing list