summaryrefslogtreecommitdiff
path: root/starmath/source/document.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-10-23 16:20:23 +0100
committerMichael Meeks <michael.meeks@novell.com>2010-10-23 16:20:23 +0100
commit2f7504f41dcd179e73728827d52f91de30815f2c (patch)
tree0c086dee529b9b6ddf82af3d9f64492b671a5d8b /starmath/source/document.cxx
parenta8e76355d980ee015162023150ae48d68fbb4124 (diff)
parent2d415c9854fb6111ac924ee95044c7e1a931433c (diff)
Merge branch 'formula' into intformulae
Conflicts: starmath/inc/node.hxx starmath/source/edit.cxx starmath/source/node.cxx starmath/source/view.cxx
Diffstat (limited to 'starmath/source/document.cxx')
-rw-r--r--starmath/source/document.cxx46
1 files changed, 38 insertions, 8 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 7cf2c52926..7029228e9e 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -97,6 +97,7 @@
#include "mathmlexport.hxx"
#include <sfx2/sfxsids.hrc>
#include <svx/svxids.hrc>
+#include "cursor.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -132,7 +133,7 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
{
case HINT_FORMATCHANGED:
SetFormulaArranged(FALSE);
-
+
nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
Repaint();
@@ -251,6 +252,7 @@ void SmDocShell::Parse()
pTree = aInterpreter.Parse(aText);
nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
SetFormulaArranged( FALSE );
+ InvalidateCursor();
}
@@ -433,9 +435,10 @@ SfxItemPool& SmDocShell::GetEditEngineItemPool()
OSL_ENSURE( pEditEngineItemPool, "EditEngineItemPool missing" );
return *pEditEngineItemPool;
}
+//TODO: Move to the top of the file...
+#include "visitors.hxx"
-
-void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition)
+void SmDocShell::DrawFormula(OutputDevice &rDev, Point &rPosition, BOOL bDrawSelection)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::Draw" );
@@ -476,8 +479,16 @@ void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition)
rDev.SetLayoutMode( TEXT_LAYOUT_BIDI_LTR );
INT16 nDigitLang = rDev.GetDigitLanguage();
rDev.SetDigitLanguage( LANGUAGE_ENGLISH );
- //
- pTree->Draw(rDev, rPosition);
+
+ //Set selection if any
+ if(pCursor && bDrawSelection){
+ pCursor->AnnotateSelection();
+ SmSelectionDrawingVisitor(rDev, pTree, rPosition);
+ }
+
+ //Drawing using visitor
+ SmDrawingVisitor(rDev, rPosition, pTree);
+
//
rDev.SetLayoutMode( nLayoutMode );
rDev.SetDigitLanguage( nDigitLang );
@@ -518,6 +529,18 @@ Size SmDocShell::GetSize()
return aRet;
}
+void SmDocShell::InvalidateCursor(){
+ if(pCursor)
+ delete pCursor;
+ pCursor = NULL;
+}
+
+SmCursor& SmDocShell::GetCursor(){
+ if(!pCursor)
+ pCursor = new SmCursor(pTree, this);
+ return *pCursor;
+}
+
////////////////////////////////////////
SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
@@ -690,6 +713,7 @@ SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
nModifyCount ( 0 ),
bIsFormulaArranged ( FALSE )
{
+ pCursor = NULL;
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SmDocShell" );
SetPool(&SFX_APP()->GetPool());
@@ -714,6 +738,11 @@ SmDocShell::~SmDocShell()
EndListening(aFormat);
EndListening(*pp->GetConfig());
+
+ if(pCursor)
+ delete pCursor;
+ pCursor = NULL;
+
delete pEditEngine;
SfxItemPool::Free(pEditEngineItemPool);
delete pTree;
@@ -745,6 +774,7 @@ BOOL SmDocShell::ConvertFrom(SfxMedium &rMedium)
{
delete pTree;
pTree = 0;
+ InvalidateCursor();
}
Reference<com::sun::star::frame::XModel> xModel(GetModel());
SmXMLImportWrapper aEquation(xModel);
@@ -1217,7 +1247,7 @@ void SmDocShell::GetState(SfxItemSet &rSet)
case SID_GAPHIC_SM:
//! very old (pre UNO) and ugly hack to invalidate the SmGraphicWindow.
- //! If nModifyCount gets changed then the call below will implicitly notify
+ //! If nModifyCount gets changed then the call below will implicitly notify
//! SmGraphicController::StateChanged and there the window gets invalidated.
//! Thus all the 'nModifyCount++' before invalidating this slot.
rSet.Put(SfxInt16Item(SID_GAPHIC_SM, nModifyCount));
@@ -1301,7 +1331,7 @@ void SmDocShell::Draw(OutputDevice *pDevice,
pDevice->IntersectClipRegion(GetVisArea());
Point atmppoint;
- Draw(*pDevice, atmppoint);
+ DrawFormula(*pDevice, atmppoint);
}
SfxItemPool& SmDocShell::GetPool() const