starmath/inc/view.hxx        |  134 +++++++++++++++++++++++--------------------
 starmath/source/document.cxx |   72 ++++++++++-------------
 starmath/source/view.cxx     |   47 ++++-----------
 3 files changed, 120 insertions(+), 133 deletions(-)

New commits:
commit e42cc88032d3f59b289e5ff454101971eecc4bea
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Thu May 14 13:51:36 2015 +0900

    cleanup starmath view/document
    
    Change-Id: Ieda85c0f157a6b299ba10528dd3cee3fe9942783

diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 1256044..952dfac 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -44,47 +44,55 @@ class SmViewShell;
 class SmPrintUIOptions;
 class SmGraphicAccessible;
 
-/**************************************************************************/
-
 class SmGraphicWindow : public ScrollableWindow
 {
-    Point     aFormulaDrawPos;
-
+    Point aFormulaDrawPos;
     // old style editing pieces
     Rectangle aCursorRect;
-    bool      bIsCursorVisible;
-    bool      bIsLineVisible;
+    bool bIsCursorVisible;
+    bool bIsLineVisible;
     AutoTimer aCaretBlinkTimer;
 public:
-    bool IsCursorVisible() const { return bIsCursorVisible; }
+    bool IsCursorVisible() const
+    {
+        return bIsCursorVisible;
+    }
     void ShowCursor(bool bShow);
-    bool IsLineVisible() const { return bIsLineVisible; }
+    bool IsLineVisible() const
+    {
+        return bIsLineVisible;
+    }
     void ShowLine(bool bShow);
     const SmNode * SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol);
 protected:
-    void        SetIsCursorVisible(bool bVis) { bIsCursorVisible = bVis; }
-    using   Window::SetCursor;
-    void        SetCursor(const SmNode *pNode);
-    void        SetCursor(const Rectangle &rRect);
-    bool        IsInlineEditEnabled() const;
+    void SetIsCursorVisible(bool bVis)
+    {
+        bIsCursorVisible = bVis;
+    }
+    using Window::SetCursor;
+    void SetCursor(const SmNode *pNode);
+    void SetCursor(const Rectangle &rRect);
+    bool IsInlineEditEnabled() const;
 
 private:
-    ::com::sun::star::uno::Reference<
-        ::com::sun::star::accessibility::XAccessible >  xAccessible;
-    SmGraphicAccessible *                                       pAccessible;
+    css::uno::Reference<css::accessibility::XAccessible> xAccessible;
+    SmGraphicAccessible* pAccessible;
 
-    SmViewShell    *pViewShell;
-    sal_uInt16          nZoom;
+    SmViewShell* pViewShell;
+    sal_uInt16 nZoom;
 
 protected:
-    void        SetFormulaDrawPos(const Point &rPos) { aFormulaDrawPos = rPos; 
}
+    void SetFormulaDrawPos(const Point &rPos)
+    {
+        aFormulaDrawPos = rPos;
+    }
 
     virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) 
SAL_OVERRIDE;
     virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
     virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
     virtual void StateChanged( StateChangedType eChanged ) SAL_OVERRIDE;
-    DECL_LINK(MenuSelectHdl, Menu *);
+    DECL_LINK(MenuSelectHdl, Menu*);
 
 private:
     void RepaintViewShellDoc();
@@ -98,35 +106,45 @@ public:
     virtual void dispose() SAL_OVERRIDE;
 
     // Window
-    virtual void    MouseButtonDown(const MouseEvent &rMEvt) SAL_OVERRIDE;
-    virtual void    MouseMove(const MouseEvent &rMEvt) SAL_OVERRIDE;
-    virtual void    GetFocus() SAL_OVERRIDE;
-    virtual void    LoseFocus() SAL_OVERRIDE;
+    virtual void MouseButtonDown(const MouseEvent &rMEvt) SAL_OVERRIDE;
+    virtual void MouseMove(const MouseEvent &rMEvt) SAL_OVERRIDE;
+    virtual void GetFocus() SAL_OVERRIDE;
+    virtual void LoseFocus() SAL_OVERRIDE;
 
-    SmViewShell *   GetView()   { return pViewShell; }
+    SmViewShell* GetView()
+    {
+        return pViewShell;
+    }
 
-    using   Window::SetZoom;
-    void   SetZoom(sal_uInt16 Factor);
-    using   Window::GetZoom;
-    sal_uInt16 GetZoom() const { return nZoom; }
+    using Window::SetZoom;
+    void SetZoom(sal_uInt16 Factor);
+    using Window::GetZoom;
+    sal_uInt16 GetZoom() const
+    {
+        return nZoom;
+    }
 
-    const Point &   GetFormulaDrawPos() const { return aFormulaDrawPos; }
+    const Point& GetFormulaDrawPos() const
+    {
+        return aFormulaDrawPos;
+    }
 
     void ZoomToFitInWindow();
-    using   ScrollableWindow::SetTotalSize;
+    using ScrollableWindow::SetTotalSize;
     void SetTotalSize();
 
-    void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
+    void ApplyColorConfigValues(const svtools::ColorConfig &rColorCfg);
 
     // for Accessibility
-    virtual ::com::sun::star::uno::Reference< 
::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+    virtual css::uno::Reference<css::accessibility::XAccessible> 
CreateAccessible() SAL_OVERRIDE;
 
-    using   Window::GetAccessible;
-    SmGraphicAccessible *   GetAccessible_Impl()  { return pAccessible; }
+    using Window::GetAccessible;
+    SmGraphicAccessible* GetAccessible_Impl()
+    {
+        return pAccessible;
+    }
 };
 
-/**************************************************************************/
-
 class SmGraphicController: public SfxControllerItem
 {
 protected:
@@ -138,8 +156,6 @@ public:
                               const SfxPoolItem* pState) SAL_OVERRIDE;
 };
 
-/**************************************************************************/
-
 class SmEditController: public SfxControllerItem
 {
 protected:
@@ -151,13 +167,9 @@ public:
     virtual ~SmEditController();
 #endif
 
-    virtual void StateChanged(sal_uInt16             nSID,
-                              SfxItemState       eState,
-                              const SfxPoolItem* pState) SAL_OVERRIDE;
+    virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const 
SfxPoolItem* pState) SAL_OVERRIDE;
 };
 
-/**************************************************************************/
-
 class SmCmdBoxWindow : public SfxDockingWindow
 {
     VclPtr<SmEditWindow>        aEdit;
@@ -192,21 +204,19 @@ public:
 
     void AdjustPosition();
 
-    SmEditWindow& GetEditWindow() { return *aEdit.get(); }
-    SmViewShell  *GetView();
+    SmEditWindow& GetEditWindow()
+    {
+        return *aEdit.get();
+    }
+    SmViewShell* GetView();
 };
 
-/**************************************************************************/
-
 class SmCmdBoxWrapper : public SfxChildWindow
 {
     SFX_DECL_CHILDWINDOW_WITHID(SmCmdBoxWrapper);
 
 protected:
-    SmCmdBoxWrapper(vcl::Window   *pParentWindow,
-                    sal_uInt16       nId,
-                    SfxBindings     *pBindings,
-                    SfxChildWinInfo *pInfo);
+    SmCmdBoxWrapper(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* 
pBindings, SfxChildWinInfo* pInfo);
 
 #if OSL_DEBUG_LEVEL > 1
     virtual ~SmCmdBoxWrapper();
@@ -218,11 +228,8 @@ public:
     {
         return static_cast<SmCmdBoxWindow *>(pWindow.get())->GetEditWindow();
     }
-
 };
 
-/**************************************************************************/
-
 namespace sfx2 { class FileDialogHelper; }
 struct SmViewShell_Impl;
 
@@ -233,11 +240,11 @@ class SmViewShell: public SfxViewShell
 
     std::unique_ptr<SmViewShell_Impl> pImpl;
 
-    VclPtr<SmGraphicWindow>     aGraphic;
+    VclPtr<SmGraphicWindow> aGraphic;
     SmGraphicController aGraphicController;
-    OUString            aStatusText;
+    OUString aStatusText;
 
-    bool                bPasteState;
+    bool bPasteState;
 
     DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint 
) SAL_OVERRIDE;
@@ -292,8 +299,15 @@ public:
     }
 
     SmEditWindow * GetEditWindow();
-          SmGraphicWindow & GetGraphicWindow()       { return *aGraphic.get(); 
}
-    const SmGraphicWindow & GetGraphicWindow() const { return *aGraphic.get(); 
}
+
+    SmGraphicWindow& GetGraphicWindow()
+    {
+        return *aGraphic.get();
+    }
+    const SmGraphicWindow& GetGraphicWindow() const
+    {
+        return *aGraphic.get();
+    }
 
     void        SetStatusText(const OUString& rText);
 
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 12083e4..0d123ec 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -567,54 +567,49 @@ SmPrinterAccess::~SmPrinterAccess()
         pRefDev->Pop();
 }
 
-
-
 Printer* SmDocShell::GetPrt()
 {
-    if ( SfxObjectCreateMode::EMBEDDED == GetCreateMode() )
+    if (SfxObjectCreateMode::EMBEDDED == GetCreateMode())
     {
         // Normally the server provides the printer. But if it doesn't provide 
one (e.g. because
         // there is no connection) it still can be the case that we know the 
printer because it
         // has been passed on by the server in OnDocumentPrinterChanged and 
being kept temporarily.
-        Printer *pPrt = GetDocumentPrinter();
-        if ( !pPrt && pTmpPrinter )
+        Printer* pPrt = GetDocumentPrinter();
+        if (!pPrt && pTmpPrinter)
             pPrt = pTmpPrinter;
         return pPrt;
     }
-    else if ( !pPrinter )
+    else if (!pPrinter)
     {
-        SfxItemSet *pOptions =
-            new SfxItemSet(GetPool(),
-                           SID_PRINTSIZE,       SID_PRINTSIZE,
-                           SID_PRINTZOOM,       SID_PRINTZOOM,
-                           SID_PRINTTITLE,      SID_PRINTTITLE,
-                           SID_PRINTTEXT,       SID_PRINTTEXT,
-                           SID_PRINTFRAME,      SID_PRINTFRAME,
-                           SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
-                           SID_SAVE_ONLY_USED_SYMBOLS, 
SID_SAVE_ONLY_USED_SYMBOLS,
-                           0);
-
+        SfxItemSet* pOptions = new SfxItemSet(GetPool(),
+                                              SID_PRINTSIZE,       
SID_PRINTSIZE,
+                                              SID_PRINTZOOM,       
SID_PRINTZOOM,
+                                              SID_PRINTTITLE,      
SID_PRINTTITLE,
+                                              SID_PRINTTEXT,       
SID_PRINTTEXT,
+                                              SID_PRINTFRAME,      
SID_PRINTFRAME,
+                                              SID_NO_RIGHT_SPACES, 
SID_NO_RIGHT_SPACES,
+                                              SID_SAVE_ONLY_USED_SYMBOLS, 
SID_SAVE_ONLY_USED_SYMBOLS,
+                                              0);
         SmModule *pp = SM_MOD();
         pp->GetConfig()->ConfigToItemSet(*pOptions);
         pPrinter = VclPtr<SfxPrinter>::Create(pOptions);
-        pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
+        pPrinter->SetMapMode(MapMode(MAP_100TH_MM));
     }
     return pPrinter;
 }
 
 OutputDevice* SmDocShell::GetRefDev()
 {
-    if ( SfxObjectCreateMode::EMBEDDED == GetCreateMode() )
+    if (SfxObjectCreateMode::EMBEDDED == GetCreateMode())
     {
         OutputDevice* pOutDev = GetDocumentRefDev();
-        if ( pOutDev )
+        if (pOutDev)
             return pOutDev;
     }
 
     return GetPrt();
 }
 
-
 void SmDocShell::SetPrinter( SfxPrinter *pNew )
 {
     pPrinter.disposeAndClear();
@@ -638,31 +633,30 @@ void SmDocShell::OnDocumentPrinterChanged( Printer *pPrt )
 void SmDocShell::Repaint()
 {
     bool bIsEnabled = IsEnableSetModified();
-    if ( bIsEnabled )
+    if (bIsEnabled)
         EnableSetModified( false );
 
-    SetFormulaArranged( false );
+    SetFormulaArranged(false);
 
     Size aVisSize = GetSize();
-    SetVisAreaSize( aVisSize );
-    SmViewShell *pViewSh = SmGetActiveView();
+    SetVisAreaSize(aVisSize);
+    SmViewShell* pViewSh = SmGetActiveView();
     if (pViewSh)
         pViewSh->GetGraphicWindow().Invalidate();
 
-    if ( bIsEnabled )
-        EnableSetModified( bIsEnabled );
+    if (bIsEnabled)
+        EnableSetModified(bIsEnabled);
 }
 
-
-SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags ) :
-    SfxObjectShell( i_nSfxCreationFlags ),
-    pTree               ( 0 ),
-    pEditEngineItemPool ( 0 ),
-    pEditEngine         ( 0 ),
-    pPrinter            ( 0 ),
-    pTmpPrinter         ( 0 ),
-    nModifyCount        ( 0 ),
-    bIsFormulaArranged  ( false )
+SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
+    : SfxObjectShell(i_nSfxCreationFlags)
+    , pTree(0)
+    , pEditEngineItemPool(0)
+    , pEditEngine(0)
+    , pPrinter(0)
+    , pTmpPrinter(0)
+    , nModifyCount(0)
+    , bIsFormulaArranged(false)
 {
     pCursor = NULL;
 
@@ -674,11 +668,9 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags 
) :
     StartListening(aFormat);
     StartListening(*pp->GetConfig());
 
-    SetBaseModel( new SmModel(this) );
+    SetBaseModel(new SmModel(this));
 }
 
-
-
 SmDocShell::~SmDocShell()
 {
     SmModule *pp = SM_MOD();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index a5c541c..12f5c4c 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -787,7 +787,6 @@ SfxChildAlignment 
SmCmdBoxWindow::CheckAlignment(SfxChildAlignment eActual,
     return eActual;
 }
 
-
 void SmCmdBoxWindow::StateChanged( StateChangedType nStateChange )
 {
     if (StateChangedType::InitShow == nStateChange)
@@ -804,7 +803,6 @@ void SmCmdBoxWindow::StateChanged( StateChangedType 
nStateChange )
     SfxDockingWindow::StateChanged( nStateChange );
 }
 
-
 IMPL_LINK_NOARG_TYPED( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, void )
 {
     // We want to have the focus in the edit window once Math has been opened
@@ -844,7 +842,6 @@ IMPL_LINK_NOARG_TYPED( SmCmdBoxWindow, 
InitialFocusTimerHdl, Timer *, void )
     }
 }
 
-
 void SmCmdBoxWindow::AdjustPosition()
 {
     Point aPt;
@@ -859,7 +856,6 @@ void SmCmdBoxWindow::AdjustPosition()
     SetPosPixel( aPos );
 }
 
-
 void SmCmdBoxWindow::ToggleFloatingMode()
 {
     SfxDockingWindow::ToggleFloatingMode();
@@ -868,16 +864,12 @@ void SmCmdBoxWindow::ToggleFloatingMode()
         GetFloatingWindow()->SetMinOutputSizePixel(Size (200, 50));
 }
 
-
 void SmCmdBoxWindow::GetFocus()
 {
     if (!bExiting)
         aEdit->GrabFocus();
 }
 
-/**************************************************************************/
-
-
 SFX_IMPL_DOCKINGWINDOW_WITHID(SmCmdBoxWrapper, SID_CMDBOXWINDOW);
 
 SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window *pParentWindow, sal_uInt16 nId,
@@ -892,7 +884,6 @@ SmCmdBoxWrapper::SmCmdBoxWrapper(vcl::Window 
*pParentWindow, sal_uInt16 nId,
     static_cast<SfxDockingWindow *>(pWindow.get())->Initialize(pInfo);
 }
 
-
 #if OSL_DEBUG_LEVEL > 1
 SmCmdBoxWrapper::~SmCmdBoxWrapper()
 {
@@ -906,7 +897,7 @@ struct SmViewShell_Impl
     SvtMiscOptions          aOpts;
 };
 
-TYPEINIT1( SmViewShell, SfxViewShell );
+TYPEINIT1(SmViewShell, SfxViewShell);
 
 SFX_IMPL_SUPERCLASS_INTERFACE(SmViewShell, SfxViewShell)
 
@@ -931,7 +922,6 @@ void SmViewShell::AdjustPosSizePixel(const Point &rPos, 
const Size &rSize)
     aGraphic->SetPosSizePixel(rPos, rSize);
 }
 
-
 void SmViewShell::InnerResizePixel(const Point &rOfs, const Size &rSize)
 {
     Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
@@ -947,7 +937,6 @@ void SmViewShell::InnerResizePixel(const Point &rOfs, const 
Size &rSize)
     GetGraphicWindow().SetTotalSize();
 }
 
-
 void SmViewShell::OuterResizePixel(const Point &rOfs, const Size &rSize)
 {
     SmGraphicWindow &rWin = GetGraphicWindow();
@@ -957,13 +946,11 @@ void SmViewShell::OuterResizePixel(const Point &rOfs, 
const Size &rSize)
     rWin.Update();
 }
 
-
 void SmViewShell::QueryObjAreaPixel( Rectangle& rRect ) const
 {
     rRect.SetSize( GetGraphicWindow().GetSizePixel() );
 }
 
-
 void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
 {
     const Fraction &rFrac = rX < rY ? rX : rY;
@@ -974,7 +961,6 @@ void SmViewShell::SetZoomFactor( const Fraction &rX, const 
Fraction &rY )
     SfxViewShell::SetZoomFactor( rX, rY );
 }
 
-
 Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const OUString& rLine)
 {
     Size   aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
@@ -1004,9 +990,9 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, 
const OUString& rLine)
 
 Size SmViewShell::GetTextSize(OutputDevice& rDevice, const OUString& rText, 
long MaxWidth)
 {
-    Size    aSize;
-    Size    TextSize;
-    sal_uInt16  nLines = comphelper::string::getTokenCount(rText, '\n');
+    Size aSize;
+    Size aTextSize;
+    sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
 
     for (sal_uInt16 i = 0; i < nLines; i++)
     {
@@ -1041,8 +1027,8 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, 
const OUString& rText, long
                 aText = aLine.copy(0, m);
                 aLine = aLine.replaceAt(0, m, "");
                 aSize = GetTextLineSize(rDevice, aText);
-                TextSize.Height() += aSize.Height();
-                TextSize.Width() = std::max(TextSize.Width(), 
std::min(aSize.Width(), MaxWidth));
+                aTextSize.Height() += aSize.Height();
+                aTextSize.Width() = std::max(aTextSize.Width(), 
std::min(aSize.Width(), MaxWidth));
 
                 aLine = comphelper::string::stripStart(aLine, ' ');
                 aLine = comphelper::string::stripStart(aLine, '\t');
@@ -1052,18 +1038,17 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, 
const OUString& rText, long
         }
         else
         {
-            TextSize.Height() += aSize.Height();
-            TextSize.Width() = std::max(TextSize.Width(), aSize.Width());
+            aTextSize.Height() += aSize.Height();
+            aTextSize.Width() = std::max(aTextSize.Width(), aSize.Width());
         }
     }
 
-    return TextSize;
+    return aTextSize;
 }
 
-
 void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, 
const OUString& rLine)
 {
-    Point   aPoint (rPosition);
+    Point aPoint(rPosition);
 
     sal_uInt16 nTabs = comphelper::string::getTokenCount(rLine, '\t');
     long nTabPos = 0;
@@ -1092,8 +1077,8 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, 
const Point& rPosition, co
 void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, 
const OUString& rText, sal_uInt16 MaxWidth)
 {
     sal_uInt16 nLines = comphelper::string::getTokenCount(rText, '\n');
-    Point   aPoint (rPosition);
-    Size    aSize;
+    Point aPoint(rPosition);
+    Size aSize;
 
     for (sal_uInt16 i = 0; i < nLines; i++)
     {
@@ -1298,8 +1283,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const 
SmPrintUIOptions &rPri
 
 SfxPrinter* SmViewShell::GetPrinter(bool bCreate)
 {
-    SmDocShell *pDoc = GetDoc();
-    if ( pDoc->HasPrinter() || bCreate )
+    SmDocShell* pDoc = GetDoc();
+    if (pDoc->HasPrinter() || bCreate)
         return pDoc->GetPrinter();
     return 0;
 }
@@ -1372,7 +1357,6 @@ void SmViewShell::NextError()
         ShowError( pErrorDesc );
 }
 
-
 void SmViewShell::PrevError()
 {
     SAL_WARN_IF( !GetDoc(), "starmath", "Document missing" );
@@ -1382,7 +1366,6 @@ void SmViewShell::PrevError()
         ShowError( pErrorDesc );
 }
 
-
 void SmViewShell::Insert( SfxMedium& rMedium )
 {
     SmDocShell *pDoc = GetDoc();
@@ -1890,7 +1873,6 @@ void SmViewShell::GetState(SfxItemSet &rSet)
     }
 }
 
-
 SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
     : SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS | 
SfxViewShellFlags::CAN_PRINT)
     , pImpl(new SmViewShell_Impl)
@@ -1927,7 +1909,6 @@ void SmViewShell::Deactivate( bool bIsMDIActivate )
     SfxViewShell::Deactivate( bIsMDIActivate );
 }
 
-
 void SmViewShell::Activate( bool bIsMDIActivate )
 {
     SfxViewShell::Activate( bIsMDIActivate );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to