summaryrefslogtreecommitdiff
path: root/svx/source/unoedit
diff options
context:
space:
mode:
authorThorsten Behrens <thb@openoffice.org>2002-02-28 11:25:39 +0000
committerThorsten Behrens <thb@openoffice.org>2002-02-28 11:25:39 +0000
commit5c6bba4112c0c72071bb284400f3be9e423b64bf (patch)
treea6d15e3bed843bb61a4097235ce520029e8668a6 /svx/source/unoedit
parent7b03c44f7253a59a9b4a2464edab93af0fdc177a (diff)
#96948# Corrected docs, factored out SvxEditSourceHintTranslator
Diffstat (limited to 'svx/source/unoedit')
-rw-r--r--svx/source/unoedit/makefile.mk7
-rw-r--r--svx/source/unoedit/unoedhlp.cxx155
-rw-r--r--svx/source/unoedit/unoedsrc.cxx53
-rw-r--r--svx/source/unoedit/unofored.cxx17
-rw-r--r--svx/source/unoedit/unoforou.cxx23
5 files changed, 186 insertions, 69 deletions
diff --git a/svx/source/unoedit/makefile.mk b/svx/source/unoedit/makefile.mk
index c9ffb869d79d..a04486089eff 100644
--- a/svx/source/unoedit/makefile.mk
+++ b/svx/source/unoedit/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: thb $ $Date: 2002-02-25 16:29:44 $
+# last change: $Author: thb $ $Date: 2002-02-28 12:25:39 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -78,6 +78,7 @@ ENABLE_EXCEPTIONS=TRUE
CXXFILES = \
UnoForbiddenCharsTable.cxx \
unoedsrc.cxx \
+ unoedhlp.cxx \
unoedacc.cxx \
unoviwed.cxx \
unoviwou.cxx \
@@ -90,6 +91,7 @@ CXXFILES = \
SVXLIGHTOBJFILES=\
$(OBJ)$/UnoForbiddenCharsTable.obj \
$(OBJ)$/unoedsrc.obj \
+ $(OBJ)$/unoedhlp.obj \
$(OBJ)$/unoedacc.obj \
$(OBJ)$/unoviwed.obj \
$(OBJ)$/unoviwou.obj \
@@ -102,6 +104,7 @@ SVXLIGHTOBJFILES=\
SLOFILES = \
$(SLO)$/UnoForbiddenCharsTable.obj \
$(SLO)$/unoedsrc.obj \
+ $(SLO)$/unoedhlp.obj \
$(SLO)$/unoedacc.obj \
$(SLO)$/unoviwed.obj \
$(SLO)$/unoviwou.obj \
diff --git a/svx/source/unoedit/unoedhlp.cxx b/svx/source/unoedit/unoedhlp.cxx
new file mode 100644
index 000000000000..8bb071cfad74
--- /dev/null
+++ b/svx/source/unoedit/unoedhlp.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoedhlp.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: thb $ $Date: 2002-02-28 12:25:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#include "unoedhlp.hxx"
+#include "editdata.hxx"
+
+//------------------------------------------------------------------------
+
+TYPEINIT1( SvxEditSourceHint, TextHint );
+
+SvxEditSourceHint::SvxEditSourceHint( ULONG _nId ) :
+ TextHint( _nId ),
+ mnStart( 0 ),
+ mnEnd( 0 )
+{
+}
+
+SvxEditSourceHint::SvxEditSourceHint( ULONG _nId, ULONG nValue, ULONG nStart, ULONG nEnd ) :
+ TextHint( _nId, nValue ),
+ mnStart( nStart),
+ mnEnd( nEnd )
+{
+}
+
+ULONG SvxEditSourceHint::GetValue() const
+{
+ return TextHint::GetValue();
+}
+
+ULONG SvxEditSourceHint::GetStartValue() const
+{
+ return mnStart;
+}
+
+ULONG SvxEditSourceHint::GetEndValue() const
+{
+ return mnEnd;
+}
+
+void SvxEditSourceHint::SetValue( ULONG n )
+{
+ TextHint::SetValue( n );
+}
+
+void SvxEditSourceHint::SetStartValue( ULONG n )
+{
+ mnStart = n;
+}
+
+void SvxEditSourceHint::SetEndValue( ULONG n )
+{
+ mnEnd = n;
+}
+
+//------------------------------------------------------------------------
+
+SfxHint SvxEditSourceHintTranslator::EENotification2Hint( EENotify* aNotify )
+{
+ if( aNotify )
+ {
+ switch( aNotify->eNotificationType )
+ {
+ case EE_NOTIFY_TEXTMODIFIED:
+ return TextHint( TEXT_HINT_MODIFIED, aNotify->nParagraph );
+
+ case EE_NOTIFY_PARAGRAPHINSERTED:
+ return TextHint( TEXT_HINT_PARAINSERTED, aNotify->nParagraph );
+
+ case EE_NOTIFY_PARAGRAPHREMOVED:
+ return TextHint( TEXT_HINT_PARAREMOVED, aNotify->nParagraph );
+
+ case EE_NOTIFY_PARAGRAPHSMOVED:
+ return SvxEditSourceHint( EDITSOURCE_HINT_PARASMOVED, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 );
+
+ case EE_NOTIFY_TEXTHEIGHTCHANGED:
+ return TextHint( TEXT_HINT_TEXTHEIGHTCHANGED, aNotify->nParagraph );
+
+ case EE_NOTIFY_TEXTVIEWSCROLLED:
+ return TextHint( TEXT_HINT_VIEWSCROLLED );
+
+ case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED:
+ return SvxEditSourceHint( EDITSOURCE_HINT_SELECTIONCHANGED );
+
+ default:
+ DBG_ERROR( "SvxEditSourceHintTranslator::EENotification2Hint unknown notification" );
+ break;
+ }
+ }
+
+ return SfxHint();
+}
diff --git a/svx/source/unoedit/unoedsrc.cxx b/svx/source/unoedit/unoedsrc.cxx
index 5f5be4cadec2..b40f188e6e97 100644
--- a/svx/source/unoedit/unoedsrc.cxx
+++ b/svx/source/unoedit/unoedsrc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unoedsrc.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: thb $ $Date: 2002-02-25 16:29:45 $
+ * last change: $Author: thb $ $Date: 2002-02-28 12:25:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,10 @@
#pragma hdrstop
+#ifndef _SFXBRDCST_HXX
+#include <svtools/brdcst.hxx>
+#endif
+
#include "unoedsrc.hxx"
//------------------------------------------------------------------------
@@ -105,48 +109,3 @@ SfxBroadcaster& SvxEditSource::GetBroadcaster() const
return aBroadcaster;
}
-
-//------------------------------------------------------------------------
-
-TYPEINIT1( SvxEditSourceHint, TextHint );
-
-SvxEditSourceHint::SvxEditSourceHint( ULONG nId ) : TextHint( nId )
-{
-}
-
-SvxEditSourceHint::SvxEditSourceHint( ULONG nId, ULONG nValue, ULONG nStart, ULONG nEnd ) :
- TextHint( nId, nValue ),
- mnStart( nStart),
- mnEnd( nEnd )
-{
-}
-
-ULONG SvxEditSourceHint::GetValue() const
-{
- return TextHint::GetValue();
-}
-
-ULONG SvxEditSourceHint::GetStartValue() const
-{
- return mnStart;
-}
-
-ULONG SvxEditSourceHint::GetEndValue() const
-{
- return mnEnd;
-}
-
-void SvxEditSourceHint::SetValue( ULONG n )
-{
- TextHint::SetValue( n );
-}
-
-void SvxEditSourceHint::SetStartValue( ULONG n )
-{
- mnStart = n;
-}
-
-void SvxEditSourceHint::SetEndValue( ULONG n )
-{
- mnEnd = n;
-}
diff --git a/svx/source/unoedit/unofored.cxx b/svx/source/unoedit/unofored.cxx
index 745067570341..f862daae3a11 100644
--- a/svx/source/unoedit/unofored.cxx
+++ b/svx/source/unoedit/unofored.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unofored.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: thb $ $Date: 2002-02-25 16:29:45 $
+ * last change: $Author: thb $ $Date: 2002-02-28 12:25:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,7 +107,7 @@ SfxItemSet SvxEditEngineForwarder::GetAttribs( const ESelection& rSel, BOOL bOnl
{
if( rSel.nStartPara == rSel.nEndPara )
{
- sal_uInt8 nFlags;
+ sal_uInt8 nFlags = 0;
switch( bOnlyHardAttrib )
{
case EditEngineAttribs_All:
@@ -332,11 +332,6 @@ USHORT SvxEditEngineForwarder::GetItemState( USHORT nPara, USHORT nWhich ) const
return rSet.GetItemState( nWhich );
}
-void SvxEditEngineForwarder::SetNotifyHdl( const Link& rLink )
-{
- rEditEngine.SetNotifyHdl( rLink );
-}
-
LanguageType SvxEditEngineForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const
{
return rEditEngine.GetLanguage(nPara, nIndex);
@@ -350,6 +345,12 @@ Rectangle SvxEditEngineForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) c
Rectangle SvxEditEngineForwarder::GetParaBounds( USHORT nPara ) const
{
+ const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
+ const ULONG nWidth = rEditEngine.CalcTextWidth();
+ const ULONG nHeight = rEditEngine.GetTextHeight( nPara );
+
+ return Rectangle( aPnt.X(), aPnt.Y(), nWidth, nHeight );
+
// TODO
return Rectangle();
}
diff --git a/svx/source/unoedit/unoforou.cxx b/svx/source/unoedit/unoforou.cxx
index 62a2fa88e79c..baac5572f671 100644
--- a/svx/source/unoedit/unoforou.cxx
+++ b/svx/source/unoedit/unoforou.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unoforou.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: thb $ $Date: 2002-02-25 16:29:45 $
+ * last change: $Author: thb $ $Date: 2002-02-28 12:25:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,8 +90,9 @@ using namespace ::com::sun::star;
SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl ) :
rOutliner( rOutl ),
- mpAttribsCache( NULL ),
- mpParaAttribsCache( NULL )
+ mpAttribsCache( NULL ),
+ mpParaAttribsCache( NULL ),
+ mnParaAttribsCache( 0 )
{
}
@@ -122,7 +123,7 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, BOOL
{
if( rSel.nStartPara == rSel.nEndPara )
{
- sal_uInt8 nFlags;
+ sal_uInt8 nFlags = 0;
switch( bOnlyHardAttrib )
{
@@ -302,11 +303,6 @@ void SvxOutlinerForwarder::flushCache()
}
}
-void SvxOutlinerForwarder::SetNotifyHdl( const Link& rLink )
-{
- rOutliner.SetNotifyHdl( rLink );
-}
-
LanguageType SvxOutlinerForwarder::GetLanguage( USHORT nPara, USHORT nIndex ) const
{
return rOutliner.GetLanguage(nPara, nIndex);
@@ -320,8 +316,11 @@ Rectangle SvxOutlinerForwarder::GetCharBounds( USHORT nPara, USHORT nIndex ) con
Rectangle SvxOutlinerForwarder::GetParaBounds( USHORT nPara ) const
{
- // TODO
- return Rectangle();
+ Point aPnt = rOutliner.GetDocPosTopLeft( nPara );
+ ULONG nHeight = rOutliner.GetTextHeight( nPara );
+ Size aSize = rOutliner.CalcTextSize();
+
+ return Rectangle( aPnt.X(), aPnt.Y(), aSize.Width(), nHeight );
}
sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point&, USHORT& nPara, USHORT& nIndex ) const