summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/SwNumberTree/SwNodeNum.cxx2
-rw-r--r--sw/source/core/access/acccell.cxx30
-rw-r--r--sw/source/core/access/acccell.hxx4
-rw-r--r--sw/source/core/access/acccontext.cxx304
-rw-r--r--sw/source/core/access/acccontext.hxx33
-rw-r--r--sw/source/core/access/accdoc.cxx4
-rw-r--r--sw/source/core/access/accfootnote.hxx10
-rw-r--r--sw/source/core/access/accframe.cxx266
-rw-r--r--sw/source/core/access/accframe.hxx122
-rw-r--r--sw/source/core/access/accframebase.hxx10
-rw-r--r--sw/source/core/access/accfrmobj.cxx401
-rw-r--r--sw/source/core/access/accfrmobj.hxx214
-rw-r--r--sw/source/core/access/accfrmobjmap.cxx154
-rw-r--r--sw/source/core/access/accfrmobjmap.hxx92
-rw-r--r--sw/source/core/access/accfrmobjslist.cxx129
-rw-r--r--sw/source/core/access/accfrmobjslist.hxx189
-rw-r--r--sw/source/core/access/accmap.cxx526
-rw-r--r--sw/source/core/access/accpara.cxx452
-rw-r--r--sw/source/core/access/accpara.hxx39
-rw-r--r--sw/source/core/access/accselectionhelper.cxx77
-rw-r--r--sw/source/core/access/acctable.cxx195
-rw-r--r--sw/source/core/access/acctable.hxx16
-rw-r--r--sw/source/core/access/makefile.mk6
-rw-r--r--sw/source/core/access/parachangetrackinginfo.cxx231
-rw-r--r--sw/source/core/access/parachangetrackinginfo.hxx59
-rw-r--r--sw/source/core/access/textmarkuphelper.cxx55
-rw-r--r--sw/source/core/access/textmarkuphelper.hxx29
-rw-r--r--sw/source/core/bastyp/index.cxx2
-rw-r--r--sw/source/core/crsr/crstrvl.cxx38
-rw-r--r--sw/source/core/crsr/findtxt.cxx5
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx8
-rw-r--r--sw/source/core/crsr/trvlreg.cxx2
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx1
-rwxr-xr-xsw/source/core/doc/doc.cxx9
-rw-r--r--sw/source/core/doc/docbm.cxx5
-rw-r--r--sw/source/core/doc/doccomp.cxx2
-rw-r--r--sw/source/core/doc/docdde.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx14
-rw-r--r--sw/source/core/doc/docglbl.cxx36
-rw-r--r--sw/source/core/doc/doclay.cxx2
-rw-r--r--sw/source/core/doc/docnew.cxx4
-rw-r--r--sw/source/core/doc/doctxm.cxx77
-rw-r--r--sw/source/core/docnode/ndsect.cxx263
-rw-r--r--sw/source/core/docnode/node2lay.cxx4
-rw-r--r--sw/source/core/docnode/section.cxx499
-rw-r--r--sw/source/core/draw/dview.cxx5
-rw-r--r--sw/source/core/edit/edattr.cxx8
-rw-r--r--sw/source/core/edit/edglbldc.cxx2
-rw-r--r--sw/source/core/edit/edsect.cxx16
-rw-r--r--sw/source/core/edit/edtox.cxx7
-rw-r--r--sw/source/core/fields/postithelper.cxx72
-rw-r--r--sw/source/core/frmedt/fecopy.cxx13
-rw-r--r--sw/source/core/frmedt/fefly1.cxx6
-rw-r--r--sw/source/core/frmedt/feshview.cxx7
-rw-r--r--sw/source/core/inc/cellfrm.hxx4
-rw-r--r--sw/source/core/inc/doctxm.hxx2
-rw-r--r--sw/source/core/inc/pagefrm.hxx6
-rwxr-xr-xsw/source/core/inc/unometa.hxx17
-rw-r--r--sw/source/core/inc/viewimp.hxx15
-rw-r--r--sw/source/core/inc/wrong.hxx8
-rw-r--r--sw/source/core/layout/layact.cxx24
-rw-r--r--sw/source/core/layout/pagechg.cxx14
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx50
-rw-r--r--sw/source/core/layout/wsfrm.cxx22
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx11
-rw-r--r--sw/source/core/text/inftxt.cxx6
-rw-r--r--sw/source/core/text/txtfly.cxx78
-rw-r--r--sw/source/core/text/txtfrm.cxx7
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx123
-rw-r--r--sw/source/core/undo/rolbck.cxx5
-rw-r--r--sw/source/core/undo/unattr.cxx4
-rw-r--r--sw/source/core/undo/undel.cxx9
-rw-r--r--sw/source/core/undo/unsect.cxx302
-rw-r--r--sw/source/core/unocore/unocoll.cxx7
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx85
-rw-r--r--sw/source/core/unocore/unoidx.cxx209
-rw-r--r--sw/source/core/unocore/unomap.cxx3
-rw-r--r--sw/source/core/unocore/unoobj2.cxx4
-rw-r--r--sw/source/core/unocore/unoprnms.cxx1
-rw-r--r--sw/source/core/unocore/unorefmk.cxx86
-rw-r--r--sw/source/core/unocore/unosect.cxx244
-rw-r--r--sw/source/core/view/viewimp.cxx4
-rwxr-xr-xsw/source/core/view/viewsh.cxx46
84 files changed, 3868 insertions, 2290 deletions
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx
index d1113f4fb484..d4a9dc0a07d0 100644
--- a/sw/source/core/SwNumberTree/SwNodeNum.cxx
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -38,7 +38,7 @@
#include <IDocumentListItems.hxx>
// <--
// --> OD 2010-01-13 #b6912256#
-#include <svl/svstdarr.hxx>
+//#include <svtools/svstdarr.hxx>
#include <doc.hxx>
// <--
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index b44530f40cca..f4cf864b7217 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -41,6 +41,7 @@
#include <swtable.hxx>
#include "crsrsh.hxx"
#include "viscrs.hxx"
+#include <accfrmobj.hxx>
#include <accfrmobjslist.hxx>
#include "frmfmt.hxx"
#include "cellatr.hxx"
@@ -56,6 +57,7 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
+using namespace sw::access;
const sal_Char sServiceName[] = "com.sun.star.table.AccessibleCellView";
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleCellView";
@@ -83,8 +85,7 @@ sal_Bool SwAccessibleCell::IsSelected()
return bRet;
}
-void SwAccessibleCell::GetStates(
- ::utl::AccessibleStateSetHelper& rStateSet )
+void SwAccessibleCell::GetStates( ::utl::AccessibleStateSetHelper& rStateSet )
{
SwAccessibleContext::GetStates( rStateSet );
@@ -104,11 +105,10 @@ void SwAccessibleCell::GetStates(
}
}
-SwAccessibleCell::SwAccessibleCell(
- SwAccessibleMap *pInitMap,
- const SwCellFrm *pCellFrm ) :
- SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm ),
- bIsSelected( sal_False )
+SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
+ const SwCellFrm *pCellFrm )
+ : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
+ , bIsSelected( sal_False )
{
vos::OGuard aGuard(Application::GetSolarMutex());
OUString sBoxName( pCellFrm->GetTabBox()->GetName() );
@@ -145,11 +145,11 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
{
sal_Bool bChanged = sal_False;
- const SwFrmOrObjSList aVisList( GetVisArea(), pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *GetMap() );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -184,7 +184,7 @@ sal_Bool SwAccessibleCell::_InvalidateChildrenCursorPos( const SwFrm *pFrm )
void SwAccessibleCell::_InvalidateCursorPos()
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" );
const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( pParent );
if( pTabFrm->IsFollow() )
@@ -253,21 +253,21 @@ uno::Sequence< OUString > SAL_CALL SwAccessibleCell::getSupportedServiceNames()
void SwAccessibleCell::Dispose( sal_Bool bRecursive )
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
::vos::ORef< SwAccessibleContext > xAccImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
if( xAccImpl.isValid() )
- xAccImpl->DisposeChild( GetFrm(), bRecursive );
+ xAccImpl->DisposeChild( SwAccessibleChild(GetFrm()), bRecursive );
SwAccessibleContext::Dispose( bRecursive );
}
void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox )
{
- const SwFrm *pParent = GetParent( GetFrm(), IsInPagePreview() );
+ const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
::vos::ORef< SwAccessibleContext > xAccImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
if( xAccImpl.isValid() )
- xAccImpl->InvalidateChildPosOrSize( GetFrm(), rOldBox );
+ xAccImpl->InvalidateChildPosOrSize( SwAccessibleChild(GetFrm()), rOldBox );
SwAccessibleContext::InvalidatePosOrSize( rOldBox );
}
diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx
index 4ac0e461c640..db3d7d5fd5cb 100644
--- a/sw/source/core/access/acccell.hxx
+++ b/sw/source/core/access/acccell.hxx
@@ -26,12 +26,12 @@
************************************************************************/
#ifndef _ACCCELL_HXX
#define _ACCCELL_HXX
-#ifndef _ACCCONTEXT_HXX
+
#include "acccontext.hxx"
-#endif
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
class SwCellFrm;
+class SwFrmFmt;
class SwAccessibleCell : public SwAccessibleContext,
::com::sun::star::accessibility::XAccessibleValue
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 54cf0d61f9e9..1b5e66071b84 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -38,8 +38,8 @@
#endif // #if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
#include <tools/debug.hxx>
#include <vcl/window.hxx>
-#include "errhdl.hxx"
-#include "swtypes.hxx"
+#include <errhdl.hxx>
+#include <swtypes.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
@@ -51,18 +51,22 @@
#include <unotools/accessiblerelationsethelper.hxx>
#include <viewsh.hxx>
#include <crsrsh.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <txtfrm.hxx>
#include <ndtxt.hxx>
+#include <pagefrm.hxx>
+#include <flyfrm.hxx>
+#include <dflyobj.hxx>
#include <pam.hxx>
#include <viewimp.hxx>
#include <accmap.hxx>
#include <accfrmobjslist.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <svx/AccessibleShape.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
+#include <PostItMgr.hxx>
+
+using namespace sw::access;
#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
#define DBG_MSG( _msg ) \
@@ -91,10 +95,10 @@ using ::rtl::OUString;
void SwAccessibleContext::InitStates()
{
- bIsShowingState = IsShowing();
+ bIsShowingState = GetMap() ? IsShowing( *(GetMap()) ) : sal_False;
ViewShell *pVSh = GetMap()->GetShell();
- bIsEditableState = pVSh && IsEditable( pVSh );
+ bIsEditableState = pVSh && IsEditable( pVSh );
bIsOpaqueState = pVSh && IsOpaque( pVSh );
bIsDefuncState = sal_False;
}
@@ -165,21 +169,17 @@ enum Action { NONE, SCROLLED, SCROLLED_WITHIN,
SCROLLED_IN, SCROLLED_OUT };
void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
- const SwRect& rOldVisArea )
+ const SwRect& rOldVisArea )
{
const SwRect& rNewVisArea = GetVisArea();
- SwFrmOrObj aFrm( pFrm );
- sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly();
-
- uno::Reference < XAccessible > xAcc;
+ const bool bVisibleChildrenOnly = SwAccessibleChild( pFrm ).IsVisibleChildrenOnly();
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
+ const SwAccessibleChildSList aList( *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
while( aIter != aList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
- SwRect aBox( rLower.GetBox() );
+ const SwAccessibleChild& rLower = *aIter;
+ const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
if( rLower.IsAccessible( GetShell()->IsPreView() ) )
{
Action eAction = NONE;
@@ -191,20 +191,31 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
else
{
- if( bVisibleOnly )
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
eAction = SCROLLED_IN;
+ }
else
+ {
eAction = SCROLLED;
+ }
}
}
else if( aBox.IsOver( rOldVisArea ) )
{
- if( bVisibleOnly )
+ if ( bVisibleChildrenOnly &&
+ !rLower.AlwaysIncludeAsChild() )
+ {
eAction = SCROLLED_OUT;
+ }
else
+ {
eAction = SCROLLED;
+ }
}
- else if( !bVisibleOnly )
+ else if( !bVisibleChildrenOnly ||
+ rLower.AlwaysIncludeAsChild() )
{
// This wouldn't be required if the SwAccessibleFrame,
// wouldn't know about the vis area.
@@ -212,8 +223,11 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
if( NONE != eAction )
{
- if( pLower )
+ if ( rLower.GetSwFrm() )
{
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
+ const SwFrm* pLower( rLower.GetSwFrm() );
::vos::ORef< SwAccessibleContext > xAccImpl =
GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
SCROLLED_IN == eAction );
@@ -242,10 +256,12 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
ChildrenScrolled( pLower, rOldVisArea );
}
}
- else
+ else if ( rLower.GetDrawObject() )
{
+ ASSERT( !rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rLower.GetSdrObject(),
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
this,
SCROLLED_OUT == eAction ||
SCROLLED_IN == eAction );
@@ -260,7 +276,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
GetMap() );
break;
case SCROLLED_IN:
- ScrolledInShape( rLower.GetSdrObject(),
+ ScrolledInShape( rLower.GetDrawObject(),
xAccImpl.getBodyPtr() );
break;
case SCROLLED_OUT:
@@ -268,7 +284,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
xAccImpl->ViewForwarderChanged(
::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
GetMap() );
- DisposeShape( rLower.GetSdrObject(),
+ DisposeShape( rLower.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
break;
@@ -277,14 +293,21 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
}
}
}
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do - as such children are always included as children.
+ ASSERT( rLower.AlwaysIncludeAsChild(),
+ "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" );
+ }
}
}
- else if( pLower && (!bVisibleOnly ||
- aBox.IsOver( rOldVisArea ) ||
- aBox.IsOver( rNewVisArea )) )
+ else if ( rLower.GetSwFrm() &&
+ ( !bVisibleChildrenOnly ||
+ aBox.IsOver( rOldVisArea ) ||
+ aBox.IsOver( rNewVisArea ) ) )
{
// There are no unaccessible SdrObjects that need to be notified
- ChildrenScrolled( pLower, rOldVisArea );
+ ChildrenScrolled( rLower.GetSwFrm(), rOldVisArea );
}
++aIter;
}
@@ -297,7 +320,7 @@ void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
ChildrenScrolled( GetFrm(), rOldVisArea );
sal_Bool bIsOldShowingState;
- sal_Bool bIsNewShowingState = IsShowing();
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
vos::OGuard aGuard( aMutex );
bIsOldShowingState = bIsShowingState;
@@ -327,7 +350,7 @@ void SwAccessibleContext::ScrolledIn()
"Vis area of child is wrong. Did it exist already?" );
// Send child event at parent. That's all we have to do here.
- const SwFrm *pParent = GetParent();
+ const SwFrm* pParent = GetParent();
::vos::ORef< SwAccessibleContext > xParentImpl(
GetMap()->GetContextImpl( pParent, sal_False ) );
uno::Reference < XAccessibleContext > xThis( this );
@@ -379,13 +402,13 @@ void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
tAccessibleStates _nStates )
{
- const SwFrmOrObjSList aVisList( GetVisArea(), _pFrm );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
if( pLower )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -396,10 +419,15 @@ void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
else
InvalidateChildrenStates( pLower, _nStates );
}
- else
+ else if ( rLower.GetDrawObject() )
{
// TODO: SdrObjects
}
+ else if ( rLower.GetWindow() )
+ {
+ // nothing to do ?
+ }
+
++aIter;
}
}
@@ -408,12 +436,12 @@ void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
sal_Bool bRecursive )
{
- const SwFrmOrObjSList aVisList( GetVisArea(), pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
- const SwFrm *pLower = rLower.GetSwFrm();
+ const SwAccessibleChild& rLower = *aIter;
+ const SwFrm* pLower = rLower.GetSwFrm();
if( pLower )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -424,13 +452,17 @@ void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
else if( bRecursive )
DisposeChildren( pLower, bRecursive );
}
- else
+ else if ( rLower.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl(
- GetMap()->GetContextImpl( rLower.GetSdrObject(),
+ GetMap()->GetContextImpl( rLower.GetDrawObject(),
this, sal_False ) );
if( xAccImpl.isValid() )
- DisposeShape( rLower.GetSdrObject(), xAccImpl.getBodyPtr() );
+ DisposeShape( rLower.GetDrawObject(), xAccImpl.getBodyPtr() );
+ }
+ else if ( rLower.GetWindow() )
+ {
+ DisposeChild( rLower, sal_False );
}
++aIter;
}
@@ -528,16 +560,14 @@ sal_Bool SwAccessibleContext::IsEditableState()
SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *pM,
sal_Int16 nR,
- const SwFrm *pF ) :
- SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
- pM->GetShell()->IsPreView() ),
- pMap( pM ),
- nClientId(0),
- nRole( nR ),
- bDisposing( sal_False ),
- // --> OD 2008-03-10 #i85634#
- bRegisteredAtAccessibleMap( true )
- // <--
+ const SwFrm *pF )
+ : SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
+ pM->GetShell()->IsPreView() )
+ , pMap( pM )
+ , nClientId(0)
+ , nRole( nR )
+ , bDisposing( sal_False )
+ , bRegisteredAtAccessibleMap( true )
{
InitStates();
DBG_MSG_CD( "constructed" )
@@ -548,11 +578,7 @@ SwAccessibleContext::~SwAccessibleContext()
vos::OGuard aGuard(Application::GetSolarMutex());
DBG_MSG_CD( "destructed" )
- // --> OD 2008-03-10 #i85634#
-// if( GetFrm() && GetMap() )
-// GetMap()->RemoveContext( GetFrm() );
RemoveFrmFromAccessibleMap();
- // <--
}
uno::Reference< XAccessibleContext > SAL_CALL
@@ -570,7 +596,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount( void )
CHECK_FOR_DEFUNC( XAccessibleContext )
- return bDisposing ? 0 : GetChildCount();
+ return bDisposing ? 0 : GetChildCount( *(GetMap()) );
}
uno::Reference< XAccessible> SAL_CALL
@@ -581,7 +607,7 @@ uno::Reference< XAccessible> SAL_CALL
CHECK_FOR_DEFUNC( XAccessibleContext )
- const SwFrmOrObj aChild( GetChild( nIndex ) );
+ const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
if( !aChild.IsValid() )
{
uno::Reference < XAccessibleContext > xThis( this );
@@ -602,14 +628,18 @@ uno::Reference< XAccessible> SAL_CALL
xChild = xChildImpl.getBodyPtr();
}
}
- else
+ else if ( aChild.GetDrawObject() )
{
::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
- GetMap()->GetContextImpl( aChild.GetSdrObject(),
+ GetMap()->GetContextImpl( aChild.GetDrawObject(),
this, !bDisposing ) );
if( xChildImpl.isValid() )
xChild = xChildImpl.getBodyPtr();
}
+ else if ( aChild.GetWindow() )
+ {
+ xChild = aChild.GetWindow()->GetAccessible();
+ }
return xChild;
}
@@ -656,7 +686,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent (void)
GetMap()->GetContextImpl( pUpper, !bDisposing ) );
ASSERT( xAccImpl.isValid() || bDisposing, "no parent found" );
if( xAccImpl.isValid() )
- nIndex = xAccImpl->GetChildIndex( GetFrm() );
+ nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrm()) );
}
return nIndex;
@@ -792,20 +822,24 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
if( !GetFrm()->IsRootFrm() )
{
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
aPixPoint.X() += aPixPos.X();
aPixPoint.Y() += aPixPos.Y();
}
- const SwFrmOrObj aChild( GetChildAtPixel( aPixPoint, GetMap() ) );
+ const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
if( aChild.GetSwFrm() )
{
xAcc = GetMap()->GetContext( aChild.GetSwFrm() );
}
- else if( aChild.GetSdrObject() )
+ else if( aChild.GetDrawObject() )
{
- xAcc = GetMap()->GetContext( aChild.GetSdrObject(), this );
+ xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
+ }
+ else if ( aChild.GetWindow() )
+ {
+ xAcc = aChild.GetWindow()->GetAccessible();
}
return xAcc;
@@ -843,7 +877,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent )
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Rectangle aPixBounds( 0, 0, 0, 0 );
if( GetFrm()->IsPageFrm() &&
static_cast < const SwPageFrm * >( GetFrm() )->IsEmptyPage() )
@@ -862,7 +896,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
if( !pParent->IsRootFrm() && bRelative)
{
- SwRect aParentLogBounds( GetBounds( pParent ) ); // twip rel to doc root
+ SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
aPixBounds.Move( -aParentPixPos.X(), -aParentPixPos.Y() );
}
@@ -1087,24 +1121,21 @@ void SwAccessibleContext::Dispose( sal_Bool bRecursive )
DBG_MSG_CD( "dispose" )
}
- // --> OD 2008-03-10 #i85634#
-// if( GetFrm() && GetMap() )
-// GetMap()->RemoveContext( GetFrm() );
RemoveFrmFromAccessibleMap();
- // <--
ClearFrm();
pMap = 0;
bDisposing = sal_False;
}
-void SwAccessibleContext::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
+void SwAccessibleContext::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
sal_Bool bRecursive )
{
vos::OGuard aGuard(Application::GetSolarMutex());
- SwFrmOrObj aFrmOrObj( GetFrm() );
- if( IsShowing( rChildFrmOrObj ) || !aFrmOrObj.IsVisibleChildrenOnly() )
+ if ( IsShowing( *(GetMap()), rChildFrmOrObj ) ||
+ rChildFrmOrObj.AlwaysIncludeAsChild() ||
+ !SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly() )
{
// If the object could have existed before, than there is nothing to do,
// because no wrapper exists now and therefor no one is interested to
@@ -1116,14 +1147,23 @@ void SwAccessibleContext::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
sal_True );
xAccImpl->Dispose( bRecursive );
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
- DisposeShape( rChildFrmOrObj.GetSdrObject(),
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ uno::Reference< XAccessible > xAcc =
+ rChildFrmOrObj.GetWindow()->GetAccessible();
+ aEvent.OldValue <<= xAcc;
+ FireAccessibleEvent( aEvent );
+ }
}
else if( bRecursive && rChildFrmOrObj.GetSwFrm() )
DisposeChildren( rChildFrmOrObj.GetSwFrm(), bRecursive );
@@ -1136,7 +1176,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
ASSERT( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" );
sal_Bool bIsOldShowingState;
- sal_Bool bIsNewShowingState = IsShowing();
+ sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
{
vos::OGuard aShowingStateGuard( aMutex );
bIsOldShowingState = bIsShowingState;
@@ -1154,8 +1194,8 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
FireVisibleDataEvent();
}
- SwFrmOrObj aParent( GetParent() );
- if( !bIsNewShowingState && aParent.IsVisibleChildrenOnly() )
+ if( !bIsNewShowingState &&
+ SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
{
// The frame is now invisible -> dispose it
Dispose( sal_True );
@@ -1167,7 +1207,7 @@ void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
}
void SwAccessibleContext::InvalidateChildPosOrSize(
- const SwFrmOrObj& rChildFrmOrObj,
+ const SwAccessibleChild& rChildFrmOrObj,
const SwRect& rOldFrm )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1176,15 +1216,21 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
!rChildFrmOrObj.GetSwFrm()->Frm().IsEmpty(),
"child context should have a size" );
- SwFrmOrObj aFrm( GetFrm() );
- sal_Bool bNew = rOldFrm.IsEmpty() ||
- (rOldFrm.Left() == 0 && rOldFrm.Top() == 0);
- if( IsShowing( rChildFrmOrObj ) )
+ if ( rChildFrmOrObj.AlwaysIncludeAsChild() )
+ {
+ // nothing to do;
+ return;
+ }
+
+ const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly();
+ const bool bNew = rOldFrm.IsEmpty() ||
+ ( rOldFrm.Left() == 0 && rOldFrm.Top() == 0 );
+ if( IsShowing( *(GetMap()), rChildFrmOrObj ) )
{
// If the object could have existed before, than there is nothing to do,
// because no wrapper exists now and therefor no one is interested to
// get notified of the movement.
- if( bNew || (aFrm.IsVisibleChildrenOnly() && !IsShowing( rOldFrm )) )
+ if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrm )) )
{
if( rChildFrmOrObj.GetSwFrm() )
{
@@ -1194,15 +1240,15 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
sal_True );
xAccImpl->ScrolledIn();
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
// --> OD 2004-11-29 #i37790#
if ( xAccImpl.isValid() )
{
- ScrolledInShape( rChildFrmOrObj.GetSdrObject(),
+ ScrolledInShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
else
@@ -1212,6 +1258,13 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
}
// <--
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= (rChildFrmOrObj.GetWindow()->GetAccessible());
+ FireAccessibleEvent( aEvent );
+ }
}
}
else
@@ -1220,7 +1273,7 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
// needs to be send. However, there is no wrapper existing, and so
// no notifications for grandchildren are required. If the are
// grandgrandchildren, they would be notified by the layout.
- if( aFrm.IsVisibleChildrenOnly() &&
+ if( bVisibleChildrenOnly &&
!bNew && IsShowing( rOldFrm ) )
{
if( rChildFrmOrObj.GetSwFrm() )
@@ -1231,14 +1284,19 @@ void SwAccessibleContext::InvalidateChildPosOrSize(
xAccImpl->SetParent( this );
xAccImpl->Dispose( sal_True );
}
- else
+ else if ( rChildFrmOrObj.GetDrawObject() )
{
::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
- GetMap()->GetContextImpl( rChildFrmOrObj.GetSdrObject(),
+ GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
this, sal_True );
- DisposeShape( rChildFrmOrObj.GetSdrObject(),
+ DisposeShape( rChildFrmOrObj.GetDrawObject(),
xAccImpl.getBodyPtr() );
}
+ else if ( rChildFrmOrObj.GetWindow() )
+ {
+ ASSERT( false,
+ "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <Window>." );
+ }
}
}
}
@@ -1422,13 +1480,67 @@ OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
return OUString( sStr );
}
-// --> OD 2008-03-10 #i85634#
void SwAccessibleContext::RemoveFrmFromAccessibleMap()
{
if( bRegisteredAtAccessibleMap && GetFrm() && GetMap() )
GetMap()->RemoveContext( GetFrm() );
}
-// <--
+
+bool SwAccessibleContext::HasAdditionalAccessibleChildren()
+{
+ bool bRet( false );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ bRet = pPostItMgr->HasFrmConnectedSidebarWins( *(GetFrm()) );
+ }
+ }
+
+ return bRet;
+}
+/** get additional accessible child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+Window* SwAccessibleContext::GetAdditionalAccessibleChild( const sal_Int32 nIndex )
+{
+ Window* pAdditionalAccessibleChild( 0 );
+
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pAdditionalAccessibleChild =
+ pPostItMgr->GetSidebarWinForFrmByIndex( *(GetFrm()), nIndex );
+ }
+ }
+
+ return pAdditionalAccessibleChild;
+}
+
+/** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+*/
+void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren )
+{
+ if ( GetFrm()->IsTxtFrm() )
+ {
+ SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+ if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
+ {
+ pPostItMgr->GetAllSidebarWinForFrm( *(GetFrm()), pChildren );
+ }
+ }
+}
#if (OSL_DEBUG_LEVEL > 1) && defined TEST_MIB
void lcl_SwAccessibleContext_DbgMsg( SwAccessibleContext *pThisAcc,
diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx
index 5461995bc400..8bad4ab9074b 100644
--- a/sw/source/core/access/acccontext.hxx
+++ b/sw/source/core/access/acccontext.hxx
@@ -40,8 +40,14 @@ class SwAccessibleMap;
class SwCrsrShell;
class SdrObject;
class SwPaM;
-namespace utl { class AccessibleStateSetHelper; }
-namespace accessibility { class AccessibleShape; }
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+namespace accessibility {
+ class AccessibleShape;
+}
+class SwFmtFld;
+class SwAccessibleChildContainer;
const sal_Char sAccessibleServiceName[] = "com.sun.star.accessibility.Accessible";
@@ -339,13 +345,13 @@ public:
virtual void Dispose( sal_Bool bRecursive = sal_False );
// The child object is not visible an longer and should be destroyed
- virtual void DisposeChild( const SwFrmOrObj& rFrmOrObj, sal_Bool bRecursive );
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj, sal_Bool bRecursive );
// The object has been moved by the layout
virtual void InvalidatePosOrSize( const SwRect& rFrm );
// The vhild object has been moved by the layout
- virtual void InvalidateChildPosOrSize( const SwFrmOrObj& rFrmOrObj,
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
const SwRect& rFrm );
// The content may have changed (but it hasn't tohave changed)
@@ -381,6 +387,25 @@ public:
*/
void InvalidateAttr();
+ bool HasAdditionalAccessibleChildren();
+
+ /** get additional child by index
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ Window* GetAdditionalAccessibleChild( const sal_Int32 nIndex );
+
+ /** get all additional accessible children
+
+ OD 2010-01-27 #i88070#
+
+ @author OD
+ */
+ void GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren );
+
+
const ::rtl::OUString& GetName() const { return sName; }
virtual sal_Bool HasCursor(); // required by map to remember that object
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 614366226df2..e0d3945e0a51 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -155,8 +155,10 @@ uno::Reference< XAccessible> SAL_CALL
if( mpChildWin )
{
CHECK_FOR_DEFUNC( XAccessibleContext )
- if( nIndex == GetChildCount() )
+ if ( nIndex == GetChildCount( *(GetMap()) ) )
+ {
return mpChildWin->GetAccessible();
+ }
}
return SwAccessibleContext::getAccessibleChild( nIndex );
diff --git a/sw/source/core/access/accfootnote.hxx b/sw/source/core/access/accfootnote.hxx
index 614e85f9f6b6..1c7330bc694d 100644
--- a/sw/source/core/access/accfootnote.hxx
+++ b/sw/source/core/access/accfootnote.hxx
@@ -26,9 +26,13 @@
************************************************************************/
#ifndef _ACCFOOTNOTE_HXX
#define _ACCFOOTNOTE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <sal/types.h>
+
+#include <acccontext.hxx>
+
+class SwAccessibleMap;
+class SwFtnFrm;
class SwAccessibleFootnote : public SwAccessibleContext
{
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 533cf358a618..043e40bb943b 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -52,22 +52,24 @@
#include <accfrmobjmap.hxx>
#include <accframe.hxx>
+using namespace sw::access;
// Regarding visibilily (or in terms of accessibility: regarding the showing
// state): A frame is visible and therfor contained in the tree if its frame
// size overlaps with the visible area. The bounding box however is the
// frame's paint area.
-sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Bool bInPagePreview )
+/* static */ sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm *pFrm,
+ sal_Bool bInPagePreview )
{
sal_Int32 nCount = 0;
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
nCount++;
@@ -75,7 +77,8 @@ sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- nCount += GetChildCount( rVisArea, rLower.GetSwFrm(),
+ nCount += GetChildCount( rAccMap,
+ rVisArea, rLower.GetSwFrm(),
bInPagePreview );
}
++aIter;
@@ -84,23 +87,25 @@ sal_Int32 SwAccessibleFrame::GetChildCount( const SwRect& rVisArea,
return nCount;
}
-SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Int32& rPos,
- sal_Bool bInPagePreview )
+/* static */ SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
{
- SwFrmOrObj aRet;
+ SwAccessibleChild aRet;
if( rPos >= 0 )
{
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( 0 == rPos )
@@ -111,7 +116,8 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChild( rVisArea, rLower.GetSwFrm(), rPos,
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
bInPagePreview );
}
++aIter;
@@ -121,11 +127,11 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( 0 == rPos )
@@ -136,7 +142,8 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChild( rVisArea, rLower.GetSwFrm(), rPos,
+ aRet = GetChild( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rPos,
bInPagePreview );
}
++aIter;
@@ -147,22 +154,24 @@ SwFrmOrObj SwAccessibleFrame::GetChild( const SwRect& rVisArea,
return aRet;
}
-sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const SwFrmOrObj& rChild,
- sal_Int32& rPos,
- sal_Bool bInPagePreview )
+/* static */ sal_Bool SwAccessibleFrame::GetChildIndex(
+ SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview )
{
sal_Bool bFound = sal_False;
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() && !bFound )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( rChild == rLower )
@@ -173,7 +182,8 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- bFound = GetChildIndex( rVisArea, rLower.GetSwFrm(), rChild,
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
rPos, bInPagePreview );
}
++aIter;
@@ -183,11 +193,11 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !bFound )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
if( rChild == rLower )
@@ -198,7 +208,8 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- bFound = GetChildIndex( rVisArea, rLower.GetSwFrm(), rChild,
+ bFound = GetChildIndex( rAccMap,
+ rVisArea, *(rLower.GetSwFrm()), rChild,
rPos, bInPagePreview );
}
++aIter;
@@ -208,31 +219,31 @@ sal_Bool SwAccessibleFrame::GetChildIndex( const SwRect& rVisArea,
return bFound;
}
-SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
- const SwFrm *pFrm,
+SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
const Point& rPixPos,
sal_Bool bInPagePreview,
- const SwAccessibleMap *pMap )
+ SwAccessibleMap& rAccMap )
{
- SwFrmOrObj aRet;
+ SwAccessibleChild aRet;
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here, and we have to reverse iterate,
// because objects in front should be returned.
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_reverse_iterator aRIter( aVisMap.rbegin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_reverse_iterator aRIter( aVisMap.rbegin() );
while( aRIter != aVisMap.rend() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = (*aRIter).second;
+ const SwAccessibleChild& rLower = (*aRIter).second;
// A frame is returned if it's frame size is inside the visarea
// and the positiion is inside the frame's paint area.
if( rLower.IsAccessible( bInPagePreview ) )
{
- SwRect aLogBounds( rLower.GetBounds( ) );
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- Rectangle aPixBounds( pMap->CoreToPixel( aLogBounds.SVRect() ) );
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
@@ -240,8 +251,8 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChildAtPixel( rVisArea, rLower.GetSwFrm(), rPixPos,
- bInPagePreview, pMap );
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
}
aRIter++;
}
@@ -251,19 +262,19 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
// The unsorted list is sorted enough, because it returns lower
// frames in the correct order. Morover, we can iterate forward,
// because the lowers don't overlap!
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() && !aRet.IsValid() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
// A frame is returned if it's frame size is inside the visarea
// and the positiion is inside the frame's paint area.
if( rLower.IsAccessible( bInPagePreview ) )
{
- SwRect aLogBounds( rLower.GetBounds( ) );
+ SwRect aLogBounds( rLower.GetBounds( rAccMap ) );
if( !aLogBounds.IsEmpty() )
{
- Rectangle aPixBounds( pMap->CoreToPixel( aLogBounds.SVRect() ) );
+ Rectangle aPixBounds( rAccMap.CoreToPixel( aLogBounds.SVRect() ) );
if( aPixBounds.IsInside( rPixPos ) )
aRet = rLower;
}
@@ -271,8 +282,8 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- aRet = GetChildAtPixel( rVisArea, rLower.GetSwFrm(), rPixPos,
- bInPagePreview, pMap );
+ aRet = GetChildAtPixel( rVisArea, *(rLower.GetSwFrm()), rPixPos,
+ bInPagePreview, rAccMap );
}
++aIter;
}
@@ -281,18 +292,20 @@ SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const SwRect& rVisArea,
return aRet;
}
-void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
- ::std::list< SwFrmOrObj >& rChildren,
- sal_Bool bInPagePreview )
+/* static */ void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< SwAccessibleChild >& rChildren,
+ sal_Bool bInPagePreview )
{
- if( SwFrmOrObjMap::IsSortingRequired( pFrm ) )
+ if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
{
// We need a sorted list here
- const SwFrmOrObjMap aVisMap( rVisArea, pFrm );
- SwFrmOrObjMap::const_iterator aIter( aVisMap.begin() );
+ const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
while( aIter != aVisMap.end() )
{
- const SwFrmOrObj& rLower = (*aIter).second;
+ const SwAccessibleChild& rLower = (*aIter).second;
if( rLower.IsAccessible( bInPagePreview ) )
{
rChildren.push_back( rLower );
@@ -300,8 +313,8 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- GetChildren( rVisArea, rLower.GetSwFrm(), rChildren,
- bInPagePreview );
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
}
++aIter;
}
@@ -310,11 +323,11 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
{
// The unsorted list is sorted enough, because it return lower
// frames in the correct order.
- const SwFrmOrObjSList aVisList( rVisArea, pFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( bInPagePreview ) )
{
rChildren.push_back( rLower );
@@ -322,21 +335,22 @@ void SwAccessibleFrame::GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
else if( rLower.GetSwFrm() )
{
// There are no unaccessible SdrObjects that count
- GetChildren( rVisArea, rLower.GetSwFrm(), rChildren,
- bInPagePreview );
+ GetChildren( rAccMap, rVisArea, *(rLower.GetSwFrm()),
+ rChildren, bInPagePreview );
}
++aIter;
}
}
}
-SwRect SwAccessibleFrame::GetBounds( const SwFrm *pFrm )
+SwRect SwAccessibleFrame::GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm )
{
if( !pFrm )
pFrm = GetFrm();
- SwFrmOrObj aFrm( pFrm );
- SwRect aBounds( aFrm.GetBounds().Intersection( maVisArea ) );
+ SwAccessibleChild aFrm( pFrm );
+ SwRect aBounds( aFrm.GetBounds( rAccMap ).Intersection( maVisArea ) );
return aBounds;
}
@@ -359,7 +373,7 @@ sal_Bool SwAccessibleFrame::IsEditable( ViewShell *pVSh ) const
sal_Bool SwAccessibleFrame::IsOpaque( ViewShell *pVSh ) const
{
- SwFrmOrObj aFrm( GetFrm() );
+ SwAccessibleChild aFrm( GetFrm() );
if( !aFrm.GetSwFrm() )
return sal_False;
@@ -423,71 +437,10 @@ SwAccessibleFrame::~SwAccessibleFrame()
{
}
-const SwFrm *SwAccessibleFrame::GetParent( const SwFrmOrObj& rFrmOrObj,
- sal_Bool bInPagePreview )
+/* static */ const SwFrm* SwAccessibleFrame::GetParent( const SwAccessibleChild& rFrmOrObj,
+ sal_Bool bInPagePreview )
{
- SwFrmOrObj aParent;
- const SwFrm *pFrm = rFrmOrObj.GetSwFrm();
- if( pFrm )
- {
- if( pFrm->IsFlyFrm() )
- {
- const SwFlyFrm *pFly = static_cast< const SwFlyFrm *>( pFrm );
- if( pFly->IsFlyInCntFrm() )
- {
- // For FLY_AS_CHAR the parent is the anchor
- aParent = pFly->GetAnchorFrm();
- ASSERT( aParent.IsAccessible( bInPagePreview ),
- "parent is not accessible" );
- }
- else
- {
- // In any other case the parent is the root frm
- // (in page preview, the page frame)
- if( bInPagePreview )
- aParent = pFly->FindPageFrm();
- else
- aParent = pFly->FindRootFrm();
- }
- }
- else
- {
- SwFrmOrObj aUpper( pFrm->GetUpper() );
- while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
- aUpper = aUpper.GetSwFrm()->GetUpper();
- aParent = aUpper;
- }
- }
- else if( rFrmOrObj.GetSdrObject() )
- {
- const SwDrawContact *pContact =
- static_cast< const SwDrawContact* >(
- GetUserCall( rFrmOrObj.GetSdrObject() ) );
- ASSERT( pContact, "sdr contact is missing" );
- if( pContact )
- {
- const SwFrmFmt *pFrmFmt = pContact->GetFmt();
- ASSERT( pFrmFmt, "frame format is missing" );
- if (pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId())
- {
- // For FLY_AS_CHAR the parent is the anchor
- aParent = pContact->GetAnchorFrm();
- ASSERT( aParent.IsAccessible( bInPagePreview ),
- "parent is not accessible" );
-
- }
- else
- {
- // In any other case the parent is the root frm
- if( bInPagePreview )
- aParent = pContact->GetAnchorFrm()->FindPageFrm();
- else
- aParent = pContact->GetAnchorFrm()->FindRootFrm();
- }
- }
- }
-
- return aParent.GetSwFrm();
+ return rFrmOrObj.GetParent( bInPagePreview );
}
String SwAccessibleFrame::GetFormattedPageNumber() const
@@ -501,3 +454,44 @@ String SwAccessibleFrame::GetFormattedPageNumber() const
String sRet( FormatNumber( nPageNum, nFmt ) );
return sRet;
}
+
+sal_Int32 SwAccessibleFrame::GetChildCount( SwAccessibleMap& rAccMap ) const
+{
+ return GetChildCount( rAccMap, maVisArea, mpFrm, IsInPagePreview() );
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChild(
+ SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const
+{
+ return SwAccessibleFrame::GetChild( rAccMap, maVisArea, *mpFrm, nPos, IsInPagePreview() );
+}
+
+sal_Int32 SwAccessibleFrame::GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const
+{
+ sal_Int32 nPos = 0;
+ return GetChildIndex( rAccMap, maVisArea, *mpFrm, rChild, nPos, IsInPagePreview() )
+ ? nPos
+ : -1L;
+}
+
+sw::access::SwAccessibleChild SwAccessibleFrame::GetChildAtPixel(
+ const Point& rPos,
+ SwAccessibleMap& rAccMap ) const
+{
+ return GetChildAtPixel( maVisArea, *mpFrm, rPos, IsInPagePreview(), rAccMap );
+}
+
+void SwAccessibleFrame::GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const
+{
+ GetChildren( rAccMap, maVisArea, *mpFrm, rChildren, IsInPagePreview() );
+}
+
+sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const
+{
+ return IsShowing( rFrmOrObj.GetBox( rAccMap ) );
+}
+
diff --git a/sw/source/core/access/accframe.hxx b/sw/source/core/access/accframe.hxx
index d1b256958fdb..48da1bdbb9cb 100644
--- a/sw/source/core/access/accframe.hxx
+++ b/sw/source/core/access/accframe.hxx
@@ -27,14 +27,22 @@
#ifndef _ACCFRAME_HXX
#define _ACCFRAME_HXX
+#include <swrect.hxx>
+
#include <sal/types.h>
+#include <tools/string.hxx>
#include <list>
#include <accfrmobj.hxx>
-// Any method of this class must be called with an acquired solar mutex!
-
class SwAccessibleMap;
+class SwFrm;
+class ViewShell;
+namespace sw { namespace access {
+ class SwAccessibleChild;
+}}
+
+// Any method of this class must be called with an acquired solar mutex!
class SwAccessibleFrame
{
@@ -45,26 +53,34 @@ class SwAccessibleFrame
protected:
// --> OD 2007-06-29 #i77106#
// method needs to be called by new class <SwAccessibleTableColHeaders>
- static sal_Int32 GetChildCount( const SwRect& rVisArea,
+ static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
const SwFrm *pFrm,
sal_Bool bInPagePreview );
private:
- static SwFrmOrObj GetChild( const SwRect& rVisArea,
- const SwFrm *pFrm,
- sal_Int32& rPos,
- sal_Bool bInPagePreview);
- static sal_Bool GetChildIndex( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const SwFrmOrObj& rChild,
- sal_Int32& rPos,
- sal_Bool bInPagePreview );
- static SwFrmOrObj GetChildAtPixel( const SwRect& rVisArea,
- const SwFrm *pFrm,
- const Point& rPos,
- sal_Bool bInPagePreview,
- const SwAccessibleMap *pMap );
- static void GetChildren( const SwRect& rVisArea, const SwFrm *pFrm,
- ::std::list< SwFrmOrObj >& rChildren,
+ static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview);
+
+ static sal_Bool GetChildIndex( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const sw::access::SwAccessibleChild& rChild,
+ sal_Int32& rPos,
+ sal_Bool bInPagePreview );
+
+ static sw::access::SwAccessibleChild GetChildAtPixel( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ const Point& rPos,
+ sal_Bool bInPagePreview,
+ SwAccessibleMap& rAccMap );
+
+ static void GetChildren( SwAccessibleMap& rAccMap,
+ const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren,
sal_Bool bInPagePreview );
protected:
@@ -73,9 +89,10 @@ protected:
sal_Bool IsOpaque( ViewShell *pVSh ) const;
+ sal_Bool IsShowing( const SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rFrmOrObj ) const;
inline sal_Bool IsShowing( const SwRect& rFrm ) const;
- inline sal_Bool IsShowing( const SwFrmOrObj& rFrmOrObj ) const;
- inline sal_Bool IsShowing() const;
+ inline sal_Bool IsShowing( const SwAccessibleMap& rAccMap ) const;
inline sal_Bool IsInPagePreview() const
{
@@ -94,17 +111,20 @@ protected:
public:
// Return the SwFrm this context is attached to.
- const SwFrm *GetFrm() const { return mpFrm; };
-
+ const SwFrm* GetFrm() const { return mpFrm; };
- static const SwFrm *GetParent( const SwFrmOrObj& rFrmOrObj,
+ static const SwFrm* GetParent( const sw::access::SwAccessibleChild& rFrmOrObj,
sal_Bool bInPagePreview );
+ sal_Int32 GetChildIndex( SwAccessibleMap& rAccMap,
+ const sw::access::SwAccessibleChild& rChild ) const;
+
protected:
// Return the bounding box of the frame clipped to the vis area. If
// no frame is specified, use this' frame.
- SwRect GetBounds( const SwFrm *pFrm=0 );
+ SwRect GetBounds( const SwAccessibleMap& rAccMap,
+ const SwFrm *pFrm = 0 );
// Return the upper that has a context attached. This might be
// another one than the immediate upper.
@@ -112,12 +132,13 @@ protected:
// Return the lower count or the nth lower, there the lowers have a
// not be same one as the SwFrm's lowers
- inline sal_Int32 GetChildCount() const;
- inline SwFrmOrObj GetChild( sal_Int32 nPos ) const;
- inline sal_Int32 GetChildIndex( const SwFrmOrObj& rChild ) const;
- inline SwFrmOrObj GetChildAtPixel( const Point& rPos,
- const SwAccessibleMap *pMap ) const;
- inline void GetChildren( ::std::list< SwFrmOrObj >& rChildren ) const;
+ sal_Int32 GetChildCount( SwAccessibleMap& rAccMap ) const;
+ sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
+ sal_Int32 nPos ) const;
+ sw::access::SwAccessibleChild GetChildAtPixel( const Point& rPos,
+ SwAccessibleMap& rAccMap ) const;
+ void GetChildren( SwAccessibleMap& rAccMap,
+ ::std::list< sw::access::SwAccessibleChild >& rChildren ) const;
inline void SetVisArea( const SwRect& rNewVisArea )
{
@@ -138,48 +159,17 @@ inline sal_Bool SwAccessibleFrame::IsShowing( const SwRect& rFrm ) const
return rFrm.IsOver( maVisArea );
}
-inline sal_Bool SwAccessibleFrame::IsShowing( const SwFrmOrObj& rFrmOrObj ) const
-{
- return IsShowing( rFrmOrObj.GetBox() );
-}
-
-inline sal_Bool SwAccessibleFrame::IsShowing() const
+inline sal_Bool SwAccessibleFrame::IsShowing( const SwAccessibleMap& rAccMap ) const
{
- SwFrmOrObj aFrmOrObj( GetFrm() );
- return IsShowing( aFrmOrObj );
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
+ return IsShowing( rAccMap, aFrmOrObj );
}
inline const SwFrm *SwAccessibleFrame::GetParent() const
{
- SwFrmOrObj aFrmOrObj( GetFrm() );
+ sw::access::SwAccessibleChild aFrmOrObj( GetFrm() );
return GetParent( aFrmOrObj, IsInPagePreview() );
}
-inline sal_Int32 SwAccessibleFrame::GetChildCount() const
-{
- return GetChildCount( maVisArea, mpFrm, IsInPagePreview() );
-}
-
-inline SwFrmOrObj SwAccessibleFrame::GetChild( sal_Int32 nPos ) const
-{
- return GetChild( maVisArea, mpFrm, nPos, IsInPagePreview() );
-}
-
-inline sal_Int32 SwAccessibleFrame::GetChildIndex( const SwFrmOrObj& rChild ) const
-{
- sal_Int32 nPos = 0;
- return GetChildIndex( maVisArea, mpFrm, rChild, nPos, IsInPagePreview() ) ? nPos : -1L;
-}
-
-inline SwFrmOrObj SwAccessibleFrame::GetChildAtPixel( const Point& rPos,
- const SwAccessibleMap *pMap ) const
-{
- return GetChildAtPixel( maVisArea, mpFrm, rPos, IsInPagePreview(), pMap );
-}
-
-inline void SwAccessibleFrame::GetChildren( ::std::list< SwFrmOrObj >& rChildren ) const
-{
- GetChildren( maVisArea, mpFrm, rChildren, IsInPagePreview() );
-}
#endif
diff --git a/sw/source/core/access/accframebase.hxx b/sw/source/core/access/accframebase.hxx
index d1623591ad05..faa4bb492697 100644
--- a/sw/source/core/access/accframebase.hxx
+++ b/sw/source/core/access/accframebase.hxx
@@ -26,13 +26,15 @@
************************************************************************/
#ifndef _ACCFRAMEBASE_HXX
#define _ACCFRAMEBASE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
+
+#include <calbck.hxx>
class SwFlyFrm;
-class SwAccessibleFrameBase : public SwAccessibleContext, public SwClient
+class SwAccessibleFrameBase : public SwAccessibleContext,
+ public SwClient
{
sal_Bool bIsSelected; // protected by base class mutex
diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx
index 131610c66f56..47b4007c1496 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -28,38 +28,401 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobj.hxx>
+
+#include <accmap.hxx>
+#include <acccontext.hxx>
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
+#include <cellfrm.hxx>
+#include <swtable.hxx>
+#include <dflyobj.hxx>
#include <frmfmt.hxx>
#include <fmtanchr.hxx>
-#include <accfrmobj.hxx>
#include <dcontact.hxx>
-#include <cellfrm.hxx>
-sal_Bool SwFrmOrObj::IsAccessible( sal_Bool bPagePreview ) const
+#include <vcl/window.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace access {
+
+SwAccessibleChild::SwAccessibleChild()
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{}
+
+SwAccessibleChild::SwAccessibleChild( const SdrObject* pDrawObj )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pDrawObj );
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pFrm );
+}
+
+SwAccessibleChild::SwAccessibleChild( Window* pWindow )
+ : mpFrm( 0 )
+ , mpDrawObj( 0 )
+ , mpWindow( 0 )
+{
+ Init( pWindow );
+}
+
+
+SwAccessibleChild::SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow )
+{
+ if ( pFrm )
+ {
+ Init( pFrm );
+ }
+ else if ( pDrawObj )
+ {
+ Init( pDrawObj );
+ }
+ else if ( pWindow )
+ {
+ Init( pWindow );
+ }
+ ASSERT( (!pFrm || pFrm == mpFrm) &&
+ (!pDrawObj || pDrawObj == mpDrawObj) &&
+ (!pWindow || pWindow == mpWindow),
+ "invalid frame/object/window combination" );
+
+}
+
+void SwAccessibleChild::Init( const SdrObject* pDrawObj )
+{
+ mpDrawObj = pDrawObj;
+ mpFrm = mpDrawObj && mpDrawObj->ISA(SwVirtFlyDrawObj)
+ ? static_cast < const SwVirtFlyDrawObj * >( mpDrawObj )->GetFlyFrm()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( const SwFrm* pFrm )
+{
+ mpFrm = pFrm;
+ mpDrawObj = mpFrm && mpFrm->IsFlyFrm()
+ ? static_cast < const SwFlyFrm * >( mpFrm )->GetVirtDrawObj()
+ : 0;
+ mpWindow = 0;
+}
+
+void SwAccessibleChild::Init( Window* pWindow )
+{
+ mpWindow = pWindow;
+ mpFrm = 0;
+ mpDrawObj = 0;
+}
+
+bool SwAccessibleChild::IsAccessible( sal_Bool bPagePreview ) const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsAccessibleFrm() &&
+ ( !mpFrm->IsCellFrm() ||
+ static_cast<const SwCellFrm *>( mpFrm )->GetTabBox()->GetSttNd() != 0 ) &&
+ !mpFrm->IsInCoveredCell() &&
+ ( bPagePreview ||
+ !mpFrm->IsPageFrm() );
+ }
+ else if ( mpDrawObj )
+ {
+ bRet = true;
+ }
+ else if ( mpWindow )
+ {
+ bRet = true;
+ }
+
+ return bRet;
+}
+
+bool SwAccessibleChild::IsBoundAsChar() const
+{
+ bool bRet( false );
+
+ if ( mpFrm )
+ {
+ bRet = mpFrm->IsFlyFrm() &&
+ static_cast< const SwFlyFrm *>(mpFrm)->IsFlyInCntFrm();
+ }
+ else if ( mpDrawObj )
+ {
+ const SwFrmFmt* mpFrmFmt = ::FindFrmFmt( mpDrawObj );
+ bRet = mpFrmFmt
+ ? (FLY_AS_CHAR == mpFrmFmt->GetAnchor().GetAnchorId())
+ : false;
+ }
+ else if ( mpWindow )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
+ : mpFrm( r.mpFrm )
+ , mpDrawObj( r.mpDrawObj )
+ , mpWindow( r.mpWindow )
+{}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SwAccessibleChild& r )
+{
+ mpDrawObj = r.mpDrawObj;
+ mpFrm = r.mpFrm;
+ mpWindow = r.mpWindow;
+
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( const SdrObject* pDrawObj )
{
- return ( pFrm && pFrm->IsAccessibleFrm() &&
- ( !pFrm->IsCellFrm() ||
- static_cast<const SwCellFrm *>( pFrm )->GetTabBox()->GetSttNd() != 0 ) &&
- !pFrm->IsInCoveredCell() &&
- ( bPagePreview || !pFrm->IsPageFrm() ) ) ||
- pObj;
+ Init( pDrawObj );
+ return *this;
}
-sal_Bool SwFrmOrObj::IsBoundAsChar() const
+SwAccessibleChild& SwAccessibleChild::operator=( const SwFrm* pFrm )
{
- // currently only SwFrms are accessible
- if( pFrm )
+ Init( pFrm );
+ return *this;
+}
+
+SwAccessibleChild& SwAccessibleChild::operator=( Window* pWindow )
+{
+ Init( pWindow );
+ return *this;
+}
+
+bool SwAccessibleChild::operator==( const SwAccessibleChild& r ) const
+{
+ return mpFrm == r.mpFrm &&
+ mpDrawObj == r.mpDrawObj &&
+ mpWindow == r.mpWindow;
+}
+
+bool SwAccessibleChild::IsValid() const
+{
+ return mpFrm != 0 ||
+ mpDrawObj != 0 ||
+ mpWindow != 0;
+}
+
+const SdrObject* SwAccessibleChild::GetDrawObject() const
+{
+ return mpDrawObj;
+}
+
+const SwFrm *SwAccessibleChild::GetSwFrm() const
+{
+ return mpFrm;
+}
+
+Window* SwAccessibleChild::GetWindow() const
+{
+ return mpWindow;
+}
+
+bool SwAccessibleChild::IsVisibleChildrenOnly() const
+{
+ bool bRet( false );
+
+ if ( !mpFrm )
{
- return pFrm->IsFlyFrm() &&
- static_cast< const SwFlyFrm *>(pFrm)->IsFlyInCntFrm();
+ bRet = true;
}
else
{
- const SwFrmFmt *pFrmFmt = pObj ? ::FindFrmFmt( pObj ) : 0;
- return (pFrmFmt)
- ? static_cast<sal_Bool>(FLY_AS_CHAR ==
- pFrmFmt->GetAnchor().GetAnchorId())
- : sal_False;
+ bRet = mpFrm->IsRootFrm() ||
+ !( mpFrm->IsTabFrm() ||
+ mpFrm->IsInTab() ||
+ ( IsBoundAsChar() &&
+ static_cast<const SwFlyFrm*>(mpFrm)->GetAnchorFrm()->IsInTab() ) );
+ }
+
+ return bRet;
+}
+
+SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBox;
+
+ if ( mpFrm )
+ {
+ if ( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBox = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 1, 1 );
+ }
+ else if ( mpFrm->IsTabFrm() )
+ {
+ aBox = SwRect( mpFrm->Frm() );
+ aBox.Intersection( mpFrm->GetUpper()->Frm() );
+ }
+ else
+ {
+ aBox = mpFrm->Frm();
+ }
}
+ else if( mpDrawObj )
+ {
+ aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
+ }
+ else if ( mpWindow )
+ {
+ aBox = SwRect( rAccMap.GetShell()->GetWin()->PixelToLogic(
+ Rectangle( mpWindow->GetPosPixel(),
+ mpWindow->GetSizePixel() ) ) );
}
+ return aBox;
+}
+
+SwRect SwAccessibleChild::GetBounds( const SwAccessibleMap& rAccMap ) const
+{
+ SwRect aBound;
+
+ if( mpFrm )
+ {
+ if( mpFrm->IsPageFrm() &&
+ static_cast< const SwPageFrm * >( mpFrm )->IsEmptyPage() )
+ {
+ aBound = SwRect( mpFrm->Frm().Left(), mpFrm->Frm().Top()-1, 0, 0 );
+ }
+ else
+ aBound = mpFrm->PaintArea();
+ }
+ else if( mpDrawObj )
+ {
+ aBound = GetBox( rAccMap );
+ }
+ else if ( mpWindow )
+ {
+ aBound = GetBox( rAccMap );
+ }
+
+ return aBound;
+}
+
+bool SwAccessibleChild::AlwaysIncludeAsChild() const
+{
+ bool bAlwaysIncludedAsChild( false );
+
+ if ( mpWindow )
+ {
+ bAlwaysIncludedAsChild = true;
+ }
+
+ return bAlwaysIncludedAsChild;
+}
+
+const SwFrm* SwAccessibleChild::GetParent( const sal_Bool bInPagePreview ) const
+{
+ const SwFrm* pParent( 0 );
+
+ if ( mpFrm )
+ {
+ if( mpFrm->IsFlyFrm() )
+ {
+ const SwFlyFrm* pFly = static_cast< const SwFlyFrm *>( mpFrm );
+ if( pFly->IsFlyInCntFrm() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pFly->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ // (in page preview, the page frame)
+ if( bInPagePreview )
+ pParent = pFly->FindPageFrm();
+ else
+ pParent = pFly->FindRootFrm();
+ }
+ }
+ else
+ {
+ SwAccessibleChild aUpper( mpFrm->GetUpper() );
+ while( aUpper.GetSwFrm() && !aUpper.IsAccessible(bInPagePreview) )
+ {
+ aUpper = aUpper.GetSwFrm()->GetUpper();
+ }
+ pParent = aUpper.GetSwFrm();
+ }
+ }
+ else if( mpDrawObj )
+ {
+ const SwDrawContact *pContact =
+ static_cast< const SwDrawContact* >( GetUserCall( mpDrawObj ) );
+ ASSERT( pContact, "sdr contact is missing" );
+ if( pContact )
+ {
+ const SwFrmFmt *pFrmFmt = pContact->GetFmt();
+ ASSERT( pFrmFmt, "frame format is missing" );
+ if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() )
+ {
+ // For FLY_AS_CHAR the parent is the anchor
+ pParent = pContact->GetAnchorFrm();
+ ASSERT( SwAccessibleChild( pParent ).IsAccessible( bInPagePreview ),
+ "parent is not accessible" );
+
+ }
+ else
+ {
+ // In any other case the parent is the root frm
+ if( bInPagePreview )
+ pParent = pContact->GetAnchorFrm()->FindPageFrm();
+ else
+ pParent = pContact->GetAnchorFrm()->FindRootFrm();
+ }
+ }
+ }
+ else if ( mpWindow )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAcc =
+ mpWindow->GetAccessible();
+ if ( xAcc.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessibleContext > xAccContext =
+ xAcc->getAccessibleContext();
+ if ( xAccContext.is() )
+ {
+ css::uno::Reference < css::accessibility::XAccessible > xAccParent =
+ xAccContext->getAccessibleParent();
+ if ( xAccParent.is() )
+ {
+ SwAccessibleContext* pAccParentImpl =
+ dynamic_cast< SwAccessibleContext *>( xAccParent.get() );
+ if ( pAccParentImpl )
+ {
+ pParent = pAccParentImpl->GetFrm();
+ }
+ }
+ }
+ }
+ }
+
+ return pParent;
+}
+
+} } // eof of namespace sw::access
+
diff --git a/sw/source/core/access/accfrmobj.hxx b/sw/source/core/access/accfrmobj.hxx
index 45414f8cc6e0..76113c62eae3 100644
--- a/sw/source/core/access/accfrmobj.hxx
+++ b/sw/source/core/access/accfrmobj.hxx
@@ -26,192 +26,70 @@
************************************************************************/
#ifndef _ACCFRMOBJ_HXX
#define _ACCFRMOBJ_HXX
-#include <flyfrm.hxx>
-#include <pagefrm.hxx>
-#include <dflyobj.hxx>
-#include <swtable.hxx>
-class SwFrmOrObj
-{
- const SdrObject *pObj;
- const SwFrm *pFrm;
-
- inline void Init( const SdrObject *pO );
- inline void Init( const SwFrm *pF );
-
-public:
-
- inline SwFrmOrObj();
- inline SwFrmOrObj( const SdrObject *pO );
- inline SwFrmOrObj( const SwFrm *pF );
- inline SwFrmOrObj( const SwFrm *pF, const SdrObject *pO );
- inline SwFrmOrObj( const SwFrmOrObj& r );
+#include <sal/types.h>
- inline SwFrmOrObj& operator=( const SwFrmOrObj& r );
- inline SwFrmOrObj& operator=( const SdrObject *pO );
- inline SwFrmOrObj& operator=( const SwFrm *pF );
+class SwAccessibleMap;
+class SwFrm;
+class SdrObject;
+class Window;
+class SwRect;
- inline sal_Bool operator==( const SwFrmOrObj& r ) const;
- inline sal_Bool operator==( const SdrObject *pO ) const;
- inline sal_Bool operator==( const SwFrm *pF ) const;
-
- inline sal_Bool IsValid() const;
-
- inline const SdrObject *GetSdrObject() const;
- inline const SwFrm *GetSwFrm() const;
-
- sal_Bool IsAccessible( sal_Bool bPagePreview ) const;
- sal_Bool IsBoundAsChar() const;
- inline sal_Bool IsVisibleChildrenOnly() const;
- inline SwRect GetBox() const;
- inline SwRect GetBounds() const;
-};
+namespace sw { namespace access {
-inline void SwFrmOrObj::Init( const SdrObject *pO )
+class SwAccessibleChild
{
- pObj = pO;
- // #110094#-1
- pFrm = pObj && pObj->ISA(SwVirtFlyDrawObj)
- ? static_cast < const SwVirtFlyDrawObj * >( pObj )->GetFlyFrm()
- : 0;
-}
-
-inline void SwFrmOrObj::Init( const SwFrm *pF )
-{
- pFrm = pF;
- pObj = pFrm && pFrm->IsFlyFrm()
- ? static_cast < const SwFlyFrm * >( pFrm )->GetVirtDrawObj()
- : 0;
-}
+ public:
+ SwAccessibleChild();
+ explicit SwAccessibleChild( const SdrObject* pDrawObj );
+ explicit SwAccessibleChild( const SwFrm* pFrm );
+ explicit SwAccessibleChild( Window* pWindow );
+ SwAccessibleChild( const SwFrm* pFrm,
+ const SdrObject* pDrawObj,
+ Window* pWindow );
-inline SwFrmOrObj::SwFrmOrObj() :
- pObj( 0 ), pFrm( 0 )
-{}
+ SwAccessibleChild( const SwAccessibleChild& r );
+ SwAccessibleChild& operator=( const SwAccessibleChild& r );
-inline SwFrmOrObj::SwFrmOrObj( const SdrObject *pO )
-{
- Init( pO );
-}
+ SwAccessibleChild& operator=( const SdrObject* pDrawObj );
+ SwAccessibleChild& operator=( const SwFrm* pFrm );
+ SwAccessibleChild& operator=( Window* pWindow );
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF )
-{
- Init( pF );
-}
+ bool operator==( const SwAccessibleChild& r ) const;
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF, const SdrObject *pO )
-{
- if( pF )
- Init( pF );
- else
- Init( pO );
- ASSERT( (!pF || pF == pFrm) && (!pO || pO == pObj),
- "invalid frame/object combination" );
+ bool IsValid() const;
-}
+ const SwFrm* GetSwFrm() const;
+ const SdrObject* GetDrawObject() const;
+ Window* GetWindow() const;
-inline SwFrmOrObj::SwFrmOrObj( const SwFrmOrObj& r ) :
- pObj( r.pObj ), pFrm( r.pFrm )
-{}
+ const SwFrm* GetParent( const sal_Bool bInPagePreview ) const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrmOrObj& r )
-{
- pObj = r.pObj;
- pFrm = r.pFrm;
- return *this;
-}
+ bool IsAccessible( sal_Bool bPagePreview ) const;
+ bool IsBoundAsChar() const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SdrObject *pO )
-{
- Init( pO );
- return *this;
-}
+ bool IsVisibleChildrenOnly() const;
+ SwRect GetBox( const SwAccessibleMap& rAccMap ) const;
+ SwRect GetBounds( const SwAccessibleMap& rAccMap ) const;
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrm *pF )
-{
- Init( pF );
- return *this;
-}
+ /** indicating, if accessible child is included even, if the corresponding
+ object is not visible.
-inline sal_Bool SwFrmOrObj::operator==( const SwFrmOrObj& r ) const
-{
- return pObj == r.pObj && pFrm == r.pFrm;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SdrObject *pO ) const
-{
- return pObj == pO;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SwFrm *pF ) const
-{
- return pFrm == pF;
-}
-
-inline sal_Bool SwFrmOrObj::IsValid() const
-{
- return pObj != 0 || pFrm != 0;
-}
+ @author OD
+ */
+ bool AlwaysIncludeAsChild() const;
-inline const SdrObject *SwFrmOrObj::GetSdrObject() const
-{
- return pObj;
-}
-
-inline const SwFrm *SwFrmOrObj::GetSwFrm() const
-{
- return pFrm;
-}
+ private:
+ const SwFrm* mpFrm;
+ const SdrObject* mpDrawObj;
+ Window* mpWindow;
-inline sal_Bool SwFrmOrObj::IsVisibleChildrenOnly() const
-{
- return !pFrm || pFrm->IsRootFrm() ||
- !( pFrm->IsTabFrm() || pFrm->IsInTab() ||
- ( IsBoundAsChar() &&
- static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm()->IsInTab()) );
-}
+ void Init( const SdrObject* pDrawObj );
+ void Init( const SwFrm* pFrm );
+ void Init( Window* pWindow );
+};
-inline SwRect SwFrmOrObj::GetBox() const
-{
- if( pFrm )
- {
- if( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
- {
- SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 1, 1 );
- return aBox;
- }
- else if ( pFrm->IsTabFrm() )
- {
- SwRect aBox( pFrm->Frm() );
- aBox.Intersection( pFrm->GetUpper()->Frm() );
- return aBox;
- }
- else
- return pFrm->Frm();
- }
- else if( pObj )
- return SwRect( pObj->GetCurrentBoundRect() );
- else
- return SwRect();
-}
-
-inline SwRect SwFrmOrObj::GetBounds() const
-{
- if( pFrm )
- {
- if( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
- {
- SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 0, 0 );
- return aBox;
- }
- else
- return pFrm->PaintArea();
- }
- else if( pObj )
- return SwRect( pObj->GetCurrentBoundRect() );
- return SwRect();
-}
+} } // eof of namespace sw::access
#endif
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index 0d1bb40e39fb..11834ee89963 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -28,95 +28,141 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobjmap.hxx>
+#include <accframe.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
+#include <viewsh.hxx>
#include <doc.hxx>
#include <frmfmt.hxx>
#include <pagefrm.hxx>
#include <txtfrm.hxx>
#include <node.hxx>
-// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
-#ifndef _ACCFFRMOBJMAP_HXX
-#include <accfrmobjmap.hxx>
-#endif
-
-::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert(
- sal_uInt32 nPos, const SwFrmOrObj& rLower )
-{
- SwFrmOrObjMapKey aKey( SwFrmOrObjMapKey::TEXT, nPos );
- value_type aEntry( aKey, rLower );
- return _SwFrmOrObjMap::insert( aEntry );
-}
-
-::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert(
- const SdrObject *pObj, const SwFrmOrObj& rLower, const SwDoc *pDoc )
-{
- if( !bLayerIdsValid )
- {
- nHellId = pDoc->GetHellId();
- nControlsId = pDoc->GetControlsId();
- bLayerIdsValid = sal_True;
- }
+#include <svx/svdobj.hxx>
- SdrLayerID nLayer = pObj->GetLayer();
- SwFrmOrObjMapKey::LayerId eLayerId = (nHellId == nLayer)
- ? SwFrmOrObjMapKey::HELL
- : ((nControlsId == nLayer) ? SwFrmOrObjMapKey::CONTROLS
- : SwFrmOrObjMapKey::HEAVEN);
- SwFrmOrObjMapKey aKey( eLayerId, pObj->GetOrdNum() );
- value_type aEntry( aKey, rLower );
- return _SwFrmOrObjMap::insert( aEntry );
-}
+using namespace sw::access;
-SwFrmOrObjMap::SwFrmOrObjMap(
- const SwRect& rVisArea, const SwFrm *pFrm ) :
- bLayerIdsValid( sal_False )
+SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() )
+ , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() )
{
- SwFrmOrObj aFrm( pFrm );
- sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly();
+ const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly();
sal_uInt32 nPos = 0;
- SwFrmOrObj aLower( pFrm->GetLower() );
+ SwAccessibleChild aLower( rFrm.GetLower() );
while( aLower.GetSwFrm() )
{
- if( !bVisibleOnly || aLower.GetBox().IsOver( rVisArea ) )
- insert( nPos++, aLower );
+ if ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( nPos++, SwAccessibleChildMapKey::TEXT, aLower );
+ }
aLower = aLower.GetSwFrm()->GetNext();
}
- if( pFrm->IsPageFrm() )
+ if ( rFrm.IsPageFrm() )
{
- ASSERT( bVisibleOnly, "page frame within tab frame???" );
+ ASSERT( bVisibleChildrenOnly, "page frame within tab frame???" );
const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( pFrm );
+ static_cast< const SwPageFrm * >( &rFrm );
const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
- if( pObjs )
+ if ( pObjs )
{
- const SwDoc *pDoc = pPgFrm->GetFmt()->GetDoc();
for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
{
aLower = (*pObjs)[i]->GetDrawObj();
- if( aLower.GetBox().IsOver( rVisArea ) )
- insert( aLower.GetSdrObject(), aLower, pDoc );
+ if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
}
}
}
- else if( pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwDoc *pDoc = static_cast< const SwTxtFrm * >( pFrm )->GetNode()
- ->GetDoc();
- const SwSortedObjs *pObjs = pFrm->GetDrawObjs();
- if( pObjs )
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs )
{
for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
{
aLower = (*pObjs)[i]->GetDrawObj();
- if( aLower.IsBoundAsChar() &&
- (!bVisibleOnly || aLower.GetBox().IsOver( rVisArea )) )
- insert( aLower.GetSdrObject(), aLower, pDoc );
+ if ( aLower.IsBoundAsChar() &&
+ ( !bVisibleChildrenOnly ||
+ aLower.AlwaysIncludeAsChild() ||
+ aLower.GetBox( rAccMap ).IsOver( rVisArea ) ) )
+ {
+ insert( aLower.GetDrawObject(), aLower );
+ }
+ }
+ }
+
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ if ( pAccImpl &&
+ pAccImpl->HasAdditionalAccessibleChildren() )
+ {
+ std::vector< Window* >* pAdditionalChildren =
+ new std::vector< Window* >();
+ pAccImpl->GetAdditionalAccessibleChildren( pAdditionalChildren );
+
+ sal_Int32 nCounter( 0 );
+ for ( std::vector< Window* >::iterator aIter = pAdditionalChildren->begin();
+ aIter != pAdditionalChildren->end();
+ ++aIter )
+ {
+ aLower = (*aIter);
+ insert( ++nCounter, SwAccessibleChildMapKey::XWINDOW, aLower );
+ }
+
+ delete pAdditionalChildren;
+ }
}
}
}
}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const SwAccessibleChild& rLower )
+{
+ SwAccessibleChildMapKey aKey( eLayerId, nPos );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+::std::pair< SwAccessibleChildMap::iterator, bool > SwAccessibleChildMap::insert(
+ const SdrObject *pObj,
+ const SwAccessibleChild& rLower )
+{
+ const SdrLayerID nLayer = pObj->GetLayer();
+ SwAccessibleChildMapKey::LayerId eLayerId =
+ (nHellId == nLayer)
+ ? SwAccessibleChildMapKey::HELL
+ : ( (nControlsId == nLayer)
+ ? SwAccessibleChildMapKey::CONTROLS
+ : SwAccessibleChildMapKey::HEAVEN );
+ SwAccessibleChildMapKey aKey( eLayerId, pObj->GetOrdNum() );
+ value_type aEntry( aKey, rLower );
+ return _SwAccessibleChildMap::insert( aEntry );
+}
+
+/* static */ sal_Bool SwAccessibleChildMap::IsSortingRequired( const SwFrm& rFrm )
+{
+ return ( rFrm.IsPageFrm() &&
+ static_cast< const SwPageFrm& >( rFrm ).GetSortedObjs() ) ||
+ ( rFrm.IsTxtFrm() &&
+ rFrm.GetDrawObjs() );
+}
diff --git a/sw/source/core/access/accfrmobjmap.hxx b/sw/source/core/access/accfrmobjmap.hxx
index ab474037ef62..91365ed9c258 100644
--- a/sw/source/core/access/accfrmobjmap.hxx
+++ b/sw/source/core/access/accfrmobjmap.hxx
@@ -26,79 +26,71 @@
************************************************************************/
#ifndef _ACCFRMOBJMAP_HXX
#define _ACCFRMOBJMAP_HXX
+
#include <accfrmobj.hxx>
+#include <svx/svdtypes.hxx>
+
#include <map>
+class SwAccessibleMap;
class SwDoc;
+class SwRect;
+class SwFrm;
+class SdrObject;
-class SwFrmOrObjMapKey
+class SwAccessibleChildMapKey
{
public:
- enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS };
+ enum LayerId { INVALID, HELL, TEXT, HEAVEN, CONTROLS, XWINDOW };
+
+ inline SwAccessibleChildMapKey()
+ : eLayerId( INVALID )
+ , nOrdNum( 0 )
+ {}
+
+ inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
+ : eLayerId( eId )
+ , nOrdNum( nOrd )
+ {}
+
+ inline bool operator()( const SwAccessibleChildMapKey& r1,
+ const SwAccessibleChildMapKey& r2 ) const
+ {
+ return (r1.eLayerId == r2.eLayerId)
+ ? (r1.nOrdNum < r2.nOrdNum)
+ : (r1.eLayerId < r2.eLayerId);
+ }
+
private:
LayerId eLayerId;
sal_uInt32 nOrdNum;
-public:
-
- inline SwFrmOrObjMapKey();
- inline SwFrmOrObjMapKey( LayerId eId, sal_uInt32 nOrd );
-
- inline sal_Bool operator()( const SwFrmOrObjMapKey& r1,
- const SwFrmOrObjMapKey& r2 ) const;
};
-typedef ::std::map < SwFrmOrObjMapKey, SwFrmOrObj, SwFrmOrObjMapKey >
- _SwFrmOrObjMap;
+typedef ::std::map < SwAccessibleChildMapKey, sw::access::SwAccessibleChild, SwAccessibleChildMapKey >
+ _SwAccessibleChildMap;
-class SwFrmOrObjMap : public _SwFrmOrObjMap
+class SwAccessibleChildMap : public _SwAccessibleChildMap
{
- SdrLayerID nHellId;
- SdrLayerID nControlsId;
- sal_Bool bLayerIdsValid;
+ const SdrLayerID nHellId;
+ const SdrLayerID nControlsId;
- ::std::pair< iterator, bool > insert( sal_uInt32 nPos,
- const SwFrmOrObj& rLower );
- ::std::pair< iterator, bool > insert( const SdrObject *pObj,
- const SwFrmOrObj& rLower,
- const SwDoc *pDoc );
+ ::std::pair< iterator, bool > insert( const sal_uInt32 nPos,
+ const SwAccessibleChildMapKey::LayerId eLayerId,
+ const sw::access::SwAccessibleChild& rLower );
+ ::std::pair< iterator, bool > insert( const SdrObject* pObj,
+ const sw::access::SwAccessibleChild& rLower );
public:
- SwFrmOrObjMap( const SwRect& rVisArea, const SwFrm *pFrm );
+ SwAccessibleChildMap( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap );
- inline static sal_Bool IsSortingRequired( const SwFrm *pFrm );
+ static sal_Bool IsSortingRequired( const SwFrm& rFrm );
};
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey() :
- eLayerId( INVALID ),
- nOrdNum( 0 )
-{
-}
-
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey(
- LayerId eId, sal_uInt32 nOrd ) :
- eLayerId( eId ),
- nOrdNum( nOrd )
-{
-}
-
-inline sal_Bool SwFrmOrObjMapKey::operator()(
- const SwFrmOrObjMapKey& r1,
- const SwFrmOrObjMapKey& r2 ) const
-{
- return (r1.eLayerId == r2.eLayerId) ? (r1.nOrdNum < r2.nOrdNum) :
- (r1.eLayerId < r2.eLayerId);
-}
-
-inline sal_Bool SwFrmOrObjMap::IsSortingRequired( const SwFrm *pFrm )
-{
- return ( pFrm->IsPageFrm() &&
- static_cast< const SwPageFrm * >( pFrm )->GetSortedObjs() ) ||
- (pFrm->IsTxtFrm() && pFrm->GetDrawObjs() );
-}
-
#endif
diff --git a/sw/source/core/access/accfrmobjslist.cxx b/sw/source/core/access/accfrmobjslist.cxx
index e23cb6702a70..2f3e8399187a 100644
--- a/sw/source/core/access/accfrmobjslist.cxx
+++ b/sw/source/core/access/accfrmobjslist.cxx
@@ -28,97 +28,146 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <accfrmobjslist.hxx>
+#include <accmap.hxx>
+#include <acccontext.hxx>
#include <pagefrm.hxx>
-// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
-#include <accfrmobjslist.hxx>
+#include <anchoredobject.hxx>
+using namespace ::sw::access;
-SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList& rLst, sal_Bool ) :
- rList( rLst ), aCurr( rList.pFrm->GetLower() ), nNextObj( 0 )
+SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(
+ const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap )
+ : rList( rLst ),
+ aCurr( rList.GetFrm().GetLower() ),
+ nNextObj( 0 )
{
if( !aCurr.GetSwFrm() )
{
- if( rList.pFrm->IsPageFrm() )
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
{
- const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( rList.pFrm );
- const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
if( pObjs && pObjs->Count() )
+ {
aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
+ }
}
- else if( rList.pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwSortedObjs *pObjs = rList.pFrm->GetDrawObjs();
- if( pObjs && pObjs->Count() )
+ const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
+ if ( pObjs && pObjs->Count() )
{
aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
+ {
aCurr = (nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
-
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rAccMap.GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( 0 ) );
+ ++nNextObj;
+ }
}
}
}
- if( rList.bVisibleOnly )
+
+ if( rList.IsVisibleChildrenOnly() )
{
// Find the first visible
while( aCurr.IsValid() &&
- !aCurr.GetBox().IsOver( rList.aVisArea ) )
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rAccMap ).IsOver( rList.GetVisArea() ) )
+ {
next();
+ }
}
}
-SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::next()
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next()
{
- sal_Bool bGetSdrObject = sal_False;
- if( aCurr.GetSdrObject() )
+ bool bNextTaken( true );
+ if( aCurr.GetDrawObject() || aCurr.GetWindow() )
{
- bGetSdrObject = sal_True;
+ bNextTaken = false;
}
else if( aCurr.GetSwFrm() )
{
aCurr = aCurr.GetSwFrm()->GetNext();
if( !aCurr.GetSwFrm() )
- bGetSdrObject = sal_True;
+ {
+ bNextTaken = false;
+ }
}
- if( bGetSdrObject )
+ if( !bNextTaken )
{
- if( rList.pFrm->IsPageFrm() )
+ const SwFrm& rFrm = rList.GetFrm();
+ if( rFrm.IsPageFrm() )
{
- const SwPageFrm *pPgFrm =
- static_cast< const SwPageFrm * >( rList.pFrm );
- const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
- aCurr = (pObjs && nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
+ const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
+ aCurr = ( pObjs && nNextObj < pObjs->Count() )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
}
- else if( rList.pFrm->IsTxtFrm() )
+ else if( rFrm.IsTxtFrm() )
{
- const SwSortedObjs *pObjs = rList.pFrm->GetDrawObjs();
- aCurr = (pObjs && nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ const SwSortedObjs* pObjs = rFrm.GetDrawObjs();
+ const sal_uInt32 nObjsCount = pObjs ? pObjs->Count() : 0;
+ aCurr = ( pObjs && nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
- aCurr = (nNextObj < pObjs->Count())
- ? (*pObjs)[nNextObj++]->GetDrawObj()
- : static_cast< const SdrObject *>( 0 );
+ {
+ aCurr = ( nNextObj < nObjsCount )
+ ? (*pObjs)[nNextObj++]->GetDrawObj()
+ : static_cast< const SdrObject *>( 0 );
+ }
+ if ( !aCurr.IsValid() )
+ {
+ ::vos::ORef < SwAccessibleContext > xAccImpl =
+ rList.GetAccMap().GetContextImpl( &rFrm, sal_False );
+ if( xAccImpl.isValid() )
+ {
+ SwAccessibleContext* pAccImpl = xAccImpl.getBodyPtr();
+ aCurr = SwAccessibleChild( pAccImpl->GetAdditionalAccessibleChild( nNextObj - nObjsCount ) );
+ ++nNextObj;
+ }
+ }
}
}
return *this;
}
-SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::next_visible()
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::next_visible()
{
next();
while( aCurr.IsValid() &&
- !aCurr.GetBox().IsOver( rList.aVisArea ) )
+ !aCurr.AlwaysIncludeAsChild() &&
+ !aCurr.GetBox( rList.GetAccMap() ).IsOver( rList.GetVisArea() ) )
+ {
next();
+ }
return *this;
}
+
+SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::operator++()
+{
+ return rList.IsVisibleChildrenOnly() ? next_visible() : next();
+}
+
diff --git a/sw/source/core/access/accfrmobjslist.hxx b/sw/source/core/access/accfrmobjslist.hxx
index 2374dbc361ac..f81cfc85a9d7 100644
--- a/sw/source/core/access/accfrmobjslist.hxx
+++ b/sw/source/core/access/accfrmobjslist.hxx
@@ -28,117 +28,118 @@
#define _ACCFRMOBJSLIST_HXX
#include <accfrmobj.hxx>
+#include <swrect.hxx>
-class SwFrmOrObjSList;
+class SwAccessibleMap;
-class SwFrmOrObjSList_const_iterator
-{
- friend class SwFrmOrObjSList;
- const SwFrmOrObjSList& rList; // The frame we are iterating over
- SwFrmOrObj aCurr; // The current object
- sal_uInt16 nNextObj; // The index of the current sdr object
-
- inline SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList& rLst );
- SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList& rLst, sal_Bool );
-
-// SwFrmOrObjSList_const_iterator& begin();
- SwFrmOrObjSList_const_iterator& next();
- SwFrmOrObjSList_const_iterator& next_visible();
-
-public:
-
- inline SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList_const_iterator& rIter );
- inline sal_Bool operator==(
- const SwFrmOrObjSList_const_iterator& r ) const;
- inline sal_Bool operator!=(
- const SwFrmOrObjSList_const_iterator& r ) const;
- inline SwFrmOrObjSList_const_iterator& operator++();
- inline const SwFrmOrObj& operator*() const;
-};
+class SwAccessibleChildSList;
-// An iterator to iterate over a frame's child in any order
-class SwFrmOrObjSList
+class SwAccessibleChildSList_const_iterator
{
- friend class SwFrmOrObjSList_const_iterator;
+private:
+ friend class SwAccessibleChildSList;
- SwRect aVisArea;
- const SwFrm *pFrm; // The frame we are iterating over
- sal_Bool bVisibleOnly;
-
-public:
+ const SwAccessibleChildSList& rList; // The frame we are iterating over
+ sw::access::SwAccessibleChild aCurr; // The current object
+ sal_uInt16 nNextObj; // The index of the current sdr object
- typedef SwFrmOrObjSList_const_iterator const_iterator;
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
+ : rList( rLst )
+ , nNextObj( 0 )
+ {}
- inline SwFrmOrObjSList( const SwFrm *pF );
- inline SwFrmOrObjSList( const SwRect& rVisArea, const SwFrm *pF );
+ SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst,
+ SwAccessibleMap& rAccMap );
- inline const_iterator begin() const;
- inline const_iterator end() const;
-};
-
-inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList& rLst ) :
- rList( rLst ), nNextObj( 0 )
-{
-}
+ SwAccessibleChildSList_const_iterator& next();
+ SwAccessibleChildSList_const_iterator& next_visible();
-inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
- const SwFrmOrObjSList_const_iterator& rIter ) :
- rList( rIter.rList ),
- aCurr( rIter.aCurr ),
- nNextObj( rIter.nNextObj )
-{
-}
+public:
-inline sal_Bool SwFrmOrObjSList_const_iterator::operator==(
- const SwFrmOrObjSList_const_iterator& r ) const
-{
- return aCurr == r.aCurr;
-}
+ inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList_const_iterator& rIter )
+ : rList( rIter.rList )
+ , aCurr( rIter.aCurr )
+ , nNextObj( rIter.nNextObj )
+ {}
-inline sal_Bool SwFrmOrObjSList_const_iterator::operator!=(
- const SwFrmOrObjSList_const_iterator& r ) const
-{
- return !(aCurr == r.aCurr);
-}
+ inline sal_Bool operator==( const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return aCurr == r.aCurr;
+ }
-inline SwFrmOrObjSList_const_iterator& SwFrmOrObjSList_const_iterator::operator++()
-{
- return rList.bVisibleOnly ? next_visible() : next();
-}
+ inline sal_Bool operator!=(
+ const SwAccessibleChildSList_const_iterator& r ) const
+ {
+ return !(*this == r);
+ }
-inline const SwFrmOrObj& SwFrmOrObjSList_const_iterator::operator*() const
-{
- return aCurr;
-}
+ SwAccessibleChildSList_const_iterator& operator++();
-inline SwFrmOrObjSList::SwFrmOrObjSList( const SwFrm *pF ) :
- pFrm( pF ),
- bVisibleOnly( sal_False )
-{
-}
+ inline const sw::access::SwAccessibleChild& operator*() const
+ {
+ return aCurr;
+ }
+};
-inline SwFrmOrObjSList::SwFrmOrObjSList( const SwRect& rVisArea,
- const SwFrm *pF ) :
- aVisArea( rVisArea ),
- pFrm( pF )
+// An iterator to iterate over a frame's child in any order
+class SwAccessibleChildSList
{
- SwFrmOrObj aFrm( pFrm );
- bVisibleOnly = aFrm.IsVisibleChildrenOnly();
-}
+ const SwRect maVisArea;
+ const SwFrm& mrFrm;
+ const sal_Bool mbVisibleChildrenOnly;
+ SwAccessibleMap& mrAccMap;
-inline SwFrmOrObjSList_const_iterator SwFrmOrObjSList::begin() const
-{
-// SwFrmOrObjSList_const_iterator aIter2( *this );
-// aIter2.begin();
-// return aIter2;
- return SwFrmOrObjSList_const_iterator( *this, sal_True );
-}
+public:
-inline SwFrmOrObjSList_const_iterator SwFrmOrObjSList::end() const
-{
- return SwFrmOrObjSList_const_iterator( *this );
-}
+ typedef SwAccessibleChildSList_const_iterator const_iterator;
+
+ inline SwAccessibleChildSList( const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea()
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sal_False )
+ , mrAccMap( rAccMap )
+ {}
+
+ inline SwAccessibleChildSList( const SwRect& rVisArea,
+ const SwFrm& rFrm,
+ SwAccessibleMap& rAccMap )
+ : maVisArea( rVisArea )
+ , mrFrm( rFrm )
+ , mbVisibleChildrenOnly( sw::access::SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly() )
+ , mrAccMap( rAccMap )
+ {
+ }
+
+ inline const_iterator begin() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this, mrAccMap );
+ }
+
+ inline const_iterator end() const
+ {
+ return SwAccessibleChildSList_const_iterator( *this );
+ }
+
+ inline const SwFrm& GetFrm() const
+ {
+ return mrFrm;
+ }
+
+ inline sal_Bool IsVisibleChildrenOnly() const
+ {
+ return mbVisibleChildrenOnly;
+ }
+
+ inline const SwRect& GetVisArea() const
+ {
+ return maVisArea;
+ }
+
+ inline SwAccessibleMap& GetAccMap() const
+ {
+ return mrAccMap;
+ }
+};
#endif
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 367db154a30a..0d7ab98d3b03 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -39,9 +39,7 @@
#include <map>
#include <list>
#include <accmap.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <accdoc.hxx>
#include <accpreview.hxx>
#include <accpage.hxx>
@@ -53,7 +51,7 @@
#include <accembedded.hxx>
#include <acccell.hxx>
#include <acctable.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <rootfrm.hxx>
#include <txtfrm.hxx>
#include <hffrm.hxx>
@@ -61,10 +59,9 @@
#include <cellfrm.hxx>
#include <tabfrm.hxx>
#include <pagefrm.hxx>
+#include <flyfrm.hxx>
#include <ndtyp.hxx>
-#ifndef IDOCUMENTDRAWMODELACCESS_HXX_INCLUDED
#include <IDocumentDrawModelAccess.hxx>
-#endif
#include <svx/ShapeTypeHandler.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
@@ -77,10 +74,13 @@
#include <pam.hxx>
#include <ndtxt.hxx>
// <--
+#include <dflyobj.hxx>
+#include <prevwpage.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
+using namespace ::sw::access;
struct SwFrmFunc
{
@@ -329,7 +329,7 @@ private:
SwRect maOldBox; // the old bounds for CHILD_POS_CHANGED
// and POS_CHANGED
uno::WeakReference < XAccessible > mxAcc; // The object that fires the event
- SwFrmOrObj maFrmOrObj; // the child for CHILD_POS_CHANGED and
+ SwAccessibleChild maFrmOrObj; // the child for CHILD_POS_CHANGED and
// the same as xAcc for any other
// event type
EventType meType; // The event type
@@ -342,7 +342,7 @@ private:
public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj )
+ const SwAccessibleChild& rFrmOrObj )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
meType( eT ),
@@ -350,7 +350,7 @@ public:
{}
SwAccessibleEvent_Impl( EventType eT,
- const SwFrmOrObj& rFrmOrObj )
+ const SwAccessibleChild& rFrmOrObj )
: maFrmOrObj( rFrmOrObj ),
meType( eT ),
mnStates( 0 )
@@ -369,7 +369,7 @@ public:
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj,
+ const SwAccessibleChild& rFrmOrObj,
const SwRect& rR )
: maOldBox( rR ),
mxAcc( pA ),
@@ -385,7 +385,7 @@ public:
// --> OD 2005-12-12 #i27301# - use new type definition for parameter <_nStates>
SwAccessibleEvent_Impl( EventType eT,
SwAccessibleContext *pA,
- const SwFrmOrObj& rFrmOrObj,
+ const SwAccessibleChild& rFrmOrObj,
const tAccessibleStates _nStates )
: mxAcc( pA ),
maFrmOrObj( rFrmOrObj ),
@@ -425,7 +425,7 @@ public:
maOldBox = rOldBox;
}
- inline const SwFrmOrObj& GetFrmOrObj() const
+ inline const SwAccessibleChild& GetFrmOrObj() const
{
return maFrmOrObj;
}
@@ -524,22 +524,26 @@ public:
//------------------------------------------------------------------------------
-struct SwFrmOrObjFunc
+struct SwAccessibleChildFunc
{
- sal_Bool operator()( const SwFrmOrObj& r1,
- const SwFrmOrObj& r2 ) const
+ sal_Bool operator()( const SwAccessibleChild& r1,
+ const SwAccessibleChild& r2 ) const
{
const void *p1 = r1.GetSwFrm()
- ? static_cast < const void * >( r1.GetSwFrm())
- : static_cast < const void * >( r1.GetSdrObject() );
+ ? static_cast < const void * >( r1.GetSwFrm())
+ : ( r1.GetDrawObject()
+ ? static_cast < const void * >( r1.GetDrawObject() )
+ : static_cast < const void * >( r1.GetWindow() ) );
const void *p2 = r2.GetSwFrm()
- ? static_cast < const void * >( r2.GetSwFrm())
- : static_cast < const void * >( r2.GetSdrObject() );
+ ? static_cast < const void * >( r2.GetSwFrm())
+ : ( r2.GetDrawObject()
+ ? static_cast < const void * >( r2.GetDrawObject() )
+ : static_cast < const void * >( r2.GetWindow() ) );
return p1 < p2;
}
};
-typedef ::std::map < SwFrmOrObj, SwAccessibleEventList_Impl::iterator,
- SwFrmOrObjFunc > _SwAccessibleEventMap_Impl;
+typedef ::std::map < SwAccessibleChild, SwAccessibleEventList_Impl::iterator,
+ SwAccessibleChildFunc > _SwAccessibleEventMap_Impl;
class SwAccessibleEventMap_Impl: public _SwAccessibleEventMap_Impl
{
@@ -577,6 +581,222 @@ typedef ::std::map< uno::WeakReference < XAccessible >,
class SwAccessibleSelectedParas_Impl: public _SwAccessibleSelectedParas_Impl
{};
// <--
+
+// helper class that stores preview data
+class SwAccPreviewData
+{
+ typedef std::vector<Rectangle> Rectangles;
+ Rectangles maPreviewRects;
+ Rectangles maLogicRects;
+
+ SwRect maVisArea;
+ Fraction maScale;
+
+ const SwPageFrm *mpSelPage;
+
+ /** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+
+ @param _iorLogicPgSwRect
+ input/output parameter - reference to the logic page rectangle, which
+ has to be adjusted.
+
+ @param _rPrevwPgSwRect
+ input parameter - constant reference to the corresponding preview page
+ rectangle; needed to determine the visible part of the logic page rectangle.
+
+ @param _rPrevwWinSize
+ input paramter - constant reference to the preview window size in TWIP;
+ needed to determine the visible part of the logic page rectangle
+ */
+ void AdjustLogicPgRectToVisibleArea( SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize );
+
+public:
+ SwAccPreviewData();
+ ~SwAccPreviewData();
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize );
+
+ // OD 14.01.2003 #103492# - complete re-factoring of method due to new
+ // page/print preview functionality.
+ void InvalidateSelection( const SwPageFrm* _pSelectedPageFrm );
+
+ const SwRect& GetVisArea() const;
+
+ MapMode GetMapModeForPreview( ) const;
+
+ /** Adjust the MapMode so that the preview page appears at the
+ * proper position. rPoint identifies the page for which the
+ * MapMode should be adjusted. If bFromPreview is true, rPoint is
+ * a preview coordinate; else it's a document coordinate. */
+ // OD 17.01.2003 #103492# - delete unused 3rd parameter.
+ void AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const;
+
+ inline const SwPageFrm *GetSelPage() const { return mpSelPage; }
+
+ void DisposePage(const SwPageFrm *pPageFrm );
+};
+
+SwAccPreviewData::SwAccPreviewData() :
+ mpSelPage( 0 )
+{
+}
+
+SwAccPreviewData::~SwAccPreviewData()
+{
+}
+
+// OD 13.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::Update( const SwAccessibleMap& rAccMap,
+ const std::vector<PrevwPage*>& _rPrevwPages,
+ const Fraction& _rScale,
+ const SwPageFrm* _pSelectedPageFrm,
+ const Size& _rPrevwWinSize )
+{
+ // store preview scaling, maximal preview page size and selected page
+ maScale = _rScale;
+ mpSelPage = _pSelectedPageFrm;
+
+ // prepare loop on preview pages
+ maPreviewRects.clear();
+ maLogicRects.clear();
+ SwAccessibleChild aPage;
+ maVisArea.Clear();
+
+ // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
+ // <maVisArea>
+ for ( std::vector<PrevwPage*>::const_iterator aPageIter = _rPrevwPages.begin();
+ aPageIter != _rPrevwPages.end();
+ ++aPageIter )
+ {
+ aPage = (*aPageIter)->pPage;
+
+ // add preview page rectangle to <maPreviewRects>
+ Rectangle aPrevwPgRect( (*aPageIter)->aPrevwWinPos, (*aPageIter)->aPageSize );
+ maPreviewRects.push_back( aPrevwPgRect );
+
+ // add logic page rectangle to <maLogicRects>
+ SwRect aLogicPgSwRect( aPage.GetBox( rAccMap ) );
+ Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
+ maLogicRects.push_back( aLogicPgRect );
+ // union visible area with visible part of logic page rectangle
+ if ( (*aPageIter)->bVisible )
+ {
+ if ( !(*aPageIter)->pPage->IsEmptyPage() )
+ {
+ AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
+ SwRect( aPrevwPgRect ),
+ _rPrevwWinSize );
+ }
+ if ( maVisArea.IsEmpty() )
+ maVisArea = aLogicPgSwRect;
+ else
+ maVisArea.Union( aLogicPgSwRect );
+ }
+ }
+}
+
+// OD 16.01.2003 #103492# - complete re-factoring of method due to new page/print
+// preview functionality.
+void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm )
+{
+ mpSelPage = _pSelectedPageFrm;
+ ASSERT( mpSelPage, "selected page not found" );
+}
+
+struct ContainsPredicate
+{
+ const Point& mrPoint;
+ ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
+ bool operator() ( const Rectangle& rRect ) const
+ {
+ return rRect.IsInside( mrPoint ) ? true : false;
+ }
+};
+
+const SwRect& SwAccPreviewData::GetVisArea() const
+{
+ return maVisArea;
+}
+
+void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
+ const Point& rPoint ) const
+{
+ // adjust scale
+ rMapMode.SetScaleX( maScale );
+ rMapMode.SetScaleY( maScale );
+
+ // find proper rectangle
+ Rectangles::const_iterator aBegin = maLogicRects.begin();
+ Rectangles::const_iterator aEnd = maLogicRects.end();
+ Rectangles::const_iterator aFound = ::std::find_if( aBegin, aEnd,
+ ContainsPredicate( rPoint ) );
+
+ if( aFound != aEnd )
+ {
+ // found! set new origin
+ Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
+ aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
+ rMapMode.SetOrigin( aPoint );
+ }
+ // else: don't adjust MapMode
+}
+
+void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm )
+{
+ if( mpSelPage == pPageFrm )
+ mpSelPage = 0;
+}
+
+/** adjust logic page retangle to its visible part
+
+ OD 17.01.2003 #103492#
+
+ @author OD
+*/
+void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
+ SwRect& _iorLogicPgSwRect,
+ const SwRect& _rPrevwPgSwRect,
+ const Size& _rPrevwWinSize )
+{
+ // determine preview window rectangle
+ const SwRect aPrevwWinSwRect( Point( 0, 0 ), _rPrevwWinSize );
+ // calculate visible preview page rectangle
+ SwRect aVisPrevwPgSwRect( _rPrevwPgSwRect );
+ aVisPrevwPgSwRect.Intersection( aPrevwWinSwRect );
+ // adjust logic page rectangle
+ SwTwips nTmpDiff;
+ // left
+ nTmpDiff = aVisPrevwPgSwRect.Left() - _rPrevwPgSwRect.Left();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Left( _iorLogicPgSwRect.Left() + nTmpDiff );
+ // top
+ nTmpDiff = aVisPrevwPgSwRect.Top() - _rPrevwPgSwRect.Top();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Top( _iorLogicPgSwRect.Top() + nTmpDiff );
+ // right
+ nTmpDiff = _rPrevwPgSwRect.Right() - aVisPrevwPgSwRect.Right();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Right( _iorLogicPgSwRect.Right() - nTmpDiff );
+ // bottom
+ nTmpDiff = _rPrevwPgSwRect.Bottom() - aVisPrevwPgSwRect.Bottom();
+ if ( nTmpDiff > 0 )
+ _iorLogicPgSwRect.Bottom( _iorLogicPgSwRect.Bottom() - nTmpDiff );
+}
+
//------------------------------------------------------------------------------
static sal_Bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
const SwFrm *pFrm )
@@ -796,9 +1016,10 @@ void SwAccessibleMap::InvalidateCursorPosition(
ASSERT( pAccImpl->GetFrm(), "caret context is disposed" );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl,
- pAccImpl->GetFrm(), ACC_STATE_CARET );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ ACC_STATE_CARET );
AppendEvent( aEvent );
}
else
@@ -873,11 +1094,10 @@ void SwAccessibleMap::DoInvalidateShapeSelection()
}
if( bChanged )
{
- SwFrmOrObj aFrmOrObj( pShape->first );
- SwFrmOrObj aParent =
- SwAccessibleFrame::GetParent( aFrmOrObj,
- GetShell()->IsPreView() );
- aParents.push_back( aParent.GetSwFrm() );
+ const SwFrm* pParent = SwAccessibleFrame::GetParent(
+ SwAccessibleChild( pShape->first ),
+ GetShell()->IsPreView() );
+ aParents.push_back( pParent );
}
}
@@ -1166,7 +1386,7 @@ uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
// create & update preview data object
if( mpPreview == NULL )
mpPreview = new SwAccPreviewData();
- mpPreview->Update( _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
return xAcc;
@@ -1197,8 +1417,8 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrm *pFrm,
{
case FRM_TXT:
mnPara++;
- pAcc = new SwAccessibleParagraph( this,
- static_cast< const SwTxtFrm * >( pFrm ) );
+ pAcc = new SwAccessibleParagraph( *this,
+ static_cast< const SwTxtFrm& >( *pFrm ) );
break;
case FRM_HEADER:
pAcc = new SwAccessibleHeaderFooter( this,
@@ -1458,10 +1678,12 @@ void SwAccessibleMap::RemoveContext( const SdrObject *pObj )
}
-void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
+void SwAccessibleMap::Dispose( const SwFrm *pFrm,
+ const SdrObject *pObj,
+ Window* pWindow,
sal_Bool bRecursive )
{
- SwFrmOrObj aFrmOrObj( pFrm, pObj );
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
// Indeed, the following assert checks the frame's accessible flag,
// because that's the one that is evaluated in the layout. The frame
@@ -1470,11 +1692,11 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
ASSERT( !aFrmOrObj.GetSwFrm() || aFrmOrObj.GetSwFrm()->IsAccessibleFrm(),
"non accessible frame should be disposed" );
- ::vos::ORef< SwAccessibleContext > xAccImpl;
- ::vos::ORef< SwAccessibleContext > xParentAccImpl;
- ::vos::ORef< ::accessibility::AccessibleShape > xShapeAccImpl;
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
+ ::vos::ORef< SwAccessibleContext > xAccImpl;
+ ::vos::ORef< SwAccessibleContext > xParentAccImpl;
+ ::vos::ORef< ::accessibility::AccessibleShape > xShapeAccImpl;
// get accessible context for frame
{
vos::OGuard aGuard( maMutex );
@@ -1514,7 +1736,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
mpShapeMap )
{
SwAccessibleShapeMap_Impl::iterator aIter =
- mpShapeMap->find( aFrmOrObj.GetSdrObject() );
+ mpShapeMap->find( aFrmOrObj.GetDrawObject() );
if( aIter != mpShapeMap->end() )
{
uno::Reference < XAccessible > xAcc( (*aIter).second );
@@ -1574,7 +1796,7 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
}
else if( xShapeAccImpl.isValid() )
{
- RemoveContext( aFrmOrObj.GetSdrObject() );
+ RemoveContext( aFrmOrObj.GetDrawObject() );
xShapeAccImpl->dispose();
}
@@ -1585,9 +1807,10 @@ void SwAccessibleMap::Dispose( const SwFrm *pFrm, const SdrObject *pObj,
void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
const SdrObject *pObj,
+ Window* pWindow,
const SwRect& rOldBox )
{
- SwFrmOrObj aFrmOrObj( pFrm, pObj );
+ SwAccessibleChild aFrmOrObj( pFrm, pObj, pWindow );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
::vos::ORef< SwAccessibleContext > xAccImpl;
@@ -1669,7 +1892,7 @@ void SwAccessibleMap::InvalidatePosOrSize( const SwFrm *pFrm,
void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
{
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1708,7 +1931,7 @@ void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
// --> OD 2009-01-06 #i88069#
void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
{
- SwFrmOrObj aFrmOrObj( &rTxtFrm );
+ SwAccessibleChild aFrmOrObj( &rTxtFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1747,7 +1970,7 @@ void SwAccessibleMap::InvalidateAttr( const SwTxtFrm& rTxtFrm )
void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
{
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
sal_Bool bShapeSelected = sal_False;
const ViewShell *pVSh = GetShell();
if( pVSh->ISA( SwCrsrShell ) )
@@ -1873,7 +2096,7 @@ void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates,
const SwFrm* _pFrm )
{
// Start with the frame or the first upper that is accessible
- SwFrmOrObj aFrmOrObj( _pFrm );
+ SwAccessibleChild aFrmOrObj( _pFrm );
while( aFrmOrObj.GetSwFrm() &&
!aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
aFrmOrObj = aFrmOrObj.GetSwFrm()->GetUpper();
@@ -1885,9 +2108,10 @@ void SwAccessibleMap::InvalidateStates( tAccessibleStates _nStates,
static_cast< SwAccessibleContext *>( xAcc.get() );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl,
- pAccImpl->GetFrm(), _nStates );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl,
+ SwAccessibleChild(pAccImpl->GetFrm()),
+ _nStates );
AppendEvent( aEvent );
}
else
@@ -1902,7 +2126,7 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
sal_Bool bFrom )
{
// first, see if this frame is accessible, and if so, get the respective
- SwFrmOrObj aFrmOrObj( pFrm );
+ SwAccessibleChild aFrmOrObj( pFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1927,9 +2151,11 @@ void SwAccessibleMap::_InvalidateRelationSet( const SwFrm* pFrm,
static_cast< SwAccessibleContext *>( xAcc.get() );
if( GetShell()->ActionPend() )
{
- SwAccessibleEvent_Impl aEvent(
- SwAccessibleEvent_Impl::CARET_OR_STATES, pAccImpl, pFrm,
- bFrom ? ACC_STATE_RELATION_FROM : ACC_STATE_RELATION_TO );
+ SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES,
+ pAccImpl, SwAccessibleChild(pFrm),
+ ( bFrom
+ ? ACC_STATE_RELATION_FROM
+ : ACC_STATE_RELATION_TO ) );
AppendEvent( aEvent );
}
else
@@ -1971,7 +2197,7 @@ void SwAccessibleMap::InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
{
// first, see if this frame is accessible, and if so, get the respective
- SwFrmOrObj aFrmOrObj( &_rTxtFrm );
+ SwAccessibleChild aFrmOrObj( &_rTxtFrm );
if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
{
uno::Reference < XAccessible > xAcc;
@@ -1998,7 +2224,8 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
{
SwAccessibleEvent_Impl aEvent(
SwAccessibleEvent_Impl::CARET_OR_STATES,
- pAccImpl, &_rTxtFrm,
+ pAccImpl,
+ SwAccessibleChild( &_rTxtFrm ),
ACC_STATE_TEXT_SELECTION_CHANGED );
AppendEvent( aEvent );
}
@@ -2011,6 +2238,43 @@ void SwAccessibleMap::InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm )
}
}
+sal_Int32 SwAccessibleMap::GetChildIndex( const SwFrm& rParentFrm,
+ Window& rChild ) const
+{
+ sal_Int32 nIndex( -1 );
+
+ SwAccessibleChild aFrmOrObj( &rParentFrm );
+ if( aFrmOrObj.IsAccessible( GetShell()->IsPreView() ) )
+ {
+ uno::Reference < XAccessible > xAcc;
+ {
+ vos::OGuard aGuard( maMutex );
+
+ if( mpFrmMap )
+ {
+ SwAccessibleContextMap_Impl::iterator aIter =
+ mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+ if( aIter != mpFrmMap->end() )
+ {
+ xAcc = (*aIter).second;
+ }
+ }
+ }
+
+ if( xAcc.is() )
+ {
+ SwAccessibleContext *pAccImpl =
+ static_cast< SwAccessibleContext *>( xAcc.get() );
+
+ nIndex = pAccImpl->GetChildIndex( const_cast<SwAccessibleMap&>(*this),
+ SwAccessibleChild( &rChild ) );
+ }
+ }
+
+ return nIndex;
+}
+
+
// OD 15.01.2003 #103492# - complete re-factoring of method due to new page/print
// preview functionality.
void SwAccessibleMap::UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages,
@@ -2022,7 +2286,7 @@ void SwAccessibleMap::UpdatePreview( const std::vector<PrevwPage*>& _rPrevwPages
DBG_ASSERT( mpPreview != NULL, "no preview data?" );
// OD 15.01.2003 #103492# - adjustments for changed method signature
- mpPreview->Update( _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
+ mpPreview->Update( *this, _rPrevwPages, _rScale, _pSelectedPageFrm, _rPrevwWinSize );
// propagate change of VisArea through the document's
// accessibility tree; this will also send appropriate scroll
@@ -2247,7 +2511,7 @@ sal_Bool SwAccessibleMap::ReplaceChild (
// Also get keep parent.
uno::Reference < XAccessible > xParent( pCurrentChild->getAccessibleParent() );
pCurrentChild = 0; // well be realease by dispose
- Dispose( 0, pObj );
+ Dispose( 0, pObj, 0 );
{
vos::OGuard aGuard( maMutex );
@@ -2284,7 +2548,7 @@ sal_Bool SwAccessibleMap::ReplaceChild (
}
SwRect aEmptyRect;
- InvalidatePosOrSize( 0, pObj, aEmptyRect );
+ InvalidatePosOrSize( 0, pObj, 0, aEmptyRect );
return sal_True;
}
@@ -2612,153 +2876,13 @@ void SwAccessibleMap::InvalidateTextSelectionOfAllParas()
}
}
-//
-// SwAccPreviewData
-//
-
-SwAccPreviewData::SwAccPreviewData() :
- mpSelPage( 0 )
-{
-}
-
-SwAccPreviewData::~SwAccPreviewData()
-{
-}
-
-// OD 13.01.2003 #103492# - complete re-factoring of method due to new page/print
-// preview functionality.
-void SwAccPreviewData::Update( const std::vector<PrevwPage*>& _rPrevwPages,
- const Fraction& _rScale,
- const SwPageFrm* _pSelectedPageFrm,
- const Size& _rPrevwWinSize )
+const SwRect& SwAccessibleMap::GetVisArea() const
{
- // store preview scaling, maximal preview page size and selected page
- maScale = _rScale;
- mpSelPage = _pSelectedPageFrm;
-
- // prepare loop on preview pages
- maPreviewRects.clear();
- maLogicRects.clear();
- SwFrmOrObj aPage;
- maVisArea.Clear();
+ DBG_ASSERT( !GetShell()->IsPreView() || (mpPreview != NULL),
+ "preview without preview data?" );
- // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
- // <maVisArea>
- for ( std::vector<PrevwPage*>::const_iterator aPageIter = _rPrevwPages.begin();
- aPageIter != _rPrevwPages.end();
- ++aPageIter )
- {
- aPage = (*aPageIter)->pPage;
-
- // add preview page rectangle to <maPreviewRects>
- Rectangle aPrevwPgRect( (*aPageIter)->aPrevwWinPos, (*aPageIter)->aPageSize );
- maPreviewRects.push_back( aPrevwPgRect );
-
- // add logic page rectangle to <maLogicRects>
- SwRect aLogicPgSwRect( aPage.GetBox() );
- Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
- maLogicRects.push_back( aLogicPgRect );
- // union visible area with visible part of logic page rectangle
- if ( (*aPageIter)->bVisible )
- {
- if ( !(*aPageIter)->pPage->IsEmptyPage() )
- {
- AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
- SwRect( aPrevwPgRect ),
- _rPrevwWinSize );
- }
- if ( maVisArea.IsEmpty() )
- maVisArea = aLogicPgSwRect;
- else
- maVisArea.Union( aLogicPgSwRect );
- }
- }
+ return GetShell()->IsPreView()
+ ? mpPreview->GetVisArea()
+ : GetShell()->VisArea();
}
-// OD 16.01.2003 #103492# - complete re-factoring of method due to new page/print
-// preview functionality.
-void SwAccPreviewData::InvalidateSelection( const SwPageFrm* _pSelectedPageFrm )
-{
- mpSelPage = _pSelectedPageFrm;
- ASSERT( mpSelPage, "selected page not found" );
-}
-
-struct ContainsPredicate
-{
- const Point& mrPoint;
- ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
- bool operator() ( const Rectangle& rRect ) const
- {
- return rRect.IsInside( mrPoint ) ? true : false;
- }
-};
-
-const SwRect& SwAccPreviewData::GetVisArea() const
-{
- return maVisArea;
-}
-
-void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
- const Point& rPoint ) const
-{
- // adjust scale
- rMapMode.SetScaleX( maScale );
- rMapMode.SetScaleY( maScale );
-
- // find proper rectangle
- Rectangles::const_iterator aBegin = maLogicRects.begin();
- Rectangles::const_iterator aEnd = maLogicRects.end();
- Rectangles::const_iterator aFound = ::std::find_if( aBegin, aEnd,
- ContainsPredicate( rPoint ) );
-
- if( aFound != aEnd )
- {
- // found! set new origin
- Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
- aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
- rMapMode.SetOrigin( aPoint );
- }
- // else: don't adjust MapMode
-}
-
-void SwAccPreviewData::DisposePage(const SwPageFrm *pPageFrm )
-{
- if( mpSelPage == pPageFrm )
- mpSelPage = 0;
-}
-
-/** adjust logic page retangle to its visible part
-
- OD 17.01.2003 #103492#
-
- @author OD
-*/
-void SwAccPreviewData::AdjustLogicPgRectToVisibleArea(
- SwRect& _iorLogicPgSwRect,
- const SwRect& _rPrevwPgSwRect,
- const Size& _rPrevwWinSize )
-{
- // determine preview window rectangle
- const SwRect aPrevwWinSwRect( Point( 0, 0 ), _rPrevwWinSize );
- // calculate visible preview page rectangle
- SwRect aVisPrevwPgSwRect( _rPrevwPgSwRect );
- aVisPrevwPgSwRect.Intersection( aPrevwWinSwRect );
- // adjust logic page rectangle
- SwTwips nTmpDiff;
- // left
- nTmpDiff = aVisPrevwPgSwRect.Left() - _rPrevwPgSwRect.Left();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Left( _iorLogicPgSwRect.Left() + nTmpDiff );
- // top
- nTmpDiff = aVisPrevwPgSwRect.Top() - _rPrevwPgSwRect.Top();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Top( _iorLogicPgSwRect.Top() + nTmpDiff );
- // right
- nTmpDiff = _rPrevwPgSwRect.Right() - aVisPrevwPgSwRect.Right();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Right( _iorLogicPgSwRect.Right() - nTmpDiff );
- // bottom
- nTmpDiff = _rPrevwPgSwRect.Bottom() - aVisPrevwPgSwRect.Bottom();
- if ( nTmpDiff > 0 )
- _iorLogicPgSwRect.Bottom( _iorLogicPgSwRect.Bottom() - nTmpDiff );
-}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 3961c8988351..368e076470ab 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -29,13 +29,14 @@
#include "precompiled_sw.hxx"
#include <txtfrm.hxx>
+#include <flyfrm.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
#include <unotextrange.hxx>
#include <unocrsrhelper.hxx>
#include <crstate.hxx>
#include <accmap.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <viewopt.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -51,56 +52,44 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#include <breakit.hxx>
-#include "accpara.hxx"
-#ifndef _ACCESS_HRC
-#include "access.hrc"
-#endif
-#include "accportions.hxx"
+#include <accpara.hxx>
+#include <access.hrc>
+#include <accportions.hxx>
#include <sfx2/viewsh.hxx> // for ExecuteAtViewShell(...)
#include <sfx2/viewfrm.hxx> // for ExecuteAtViewShell(...)
#include <sfx2/dispatch.hxx> // for ExecuteAtViewShell(...)
#include <unotools/charclass.hxx> // for GetWordBoundary
// for get/setCharacterAttribute(...)
-#include "unocrsr.hxx"
-#include "unoport.hxx"
-#include "doc.hxx"
-#include "crsskip.hxx"
+#include <unocrsr.hxx>
+//#include <unoobj.hxx>
+#include <unoport.hxx>
+#include <doc.hxx>
+#include <crsskip.hxx>
#include <txtatr.hxx>
#include <acchyperlink.hxx>
#include <acchypertextdata.hxx>
-// --> OD 2005-12-02 #i27138#
#include <unotools/accessiblerelationsethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-// <--
#include <comphelper/accessibletexthelper.hxx>
-// --> OD 2006-07-12 #i63870#
#include <unomap.hxx>
-// <--
-// --> OD 2007-01-15 #i72800#
#include <unoprnms.hxx>
-// <--
-// --> OD 2007-01-15 #i73371#
#include <com/sun/star/text/WritingMode2.hpp>
-// <--
-// --> OD 2007-01-17 #i71385#
#include <editeng/brshitem.hxx>
#include <viewimp.hxx>
-// <--
-// --> OD 2007-11-12 #i82637#
#include <boost/scoped_ptr.hpp>
-// <--
-// --> OD 2008-05-26 #i71360#
#include <textmarkuphelper.hxx>
+// --> OD 2010-02-22 #i10825#
+#include <parachangetrackinginfo.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+// <--
+// --> OD 2010-03-08 #i92233#
+#include <comphelper/stlunosequence.hxx>
// <--
#include <algorithm>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;
-using ::rtl::OUString;
using beans::PropertyValue;
using beans::XMultiPropertySet;
@@ -132,15 +121,15 @@ const SwTxtNode* SwAccessibleParagraph::GetTxtNode() const
return pNode;
}
-OUString SwAccessibleParagraph::GetString()
+::rtl::OUString SwAccessibleParagraph::GetString()
{
return GetPortionData().GetAccessibleString();
}
-OUString SwAccessibleParagraph::GetDescription()
+::rtl::OUString SwAccessibleParagraph::GetDescription()
{
// --> OD 2004-09-29 #117933# - provide empty description for paragraphs
- return OUString();
+ return ::rtl::OUString();
// <--
}
@@ -389,11 +378,11 @@ void SwAccessibleParagraph::GetStates(
void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
{
- OUString sOldText( GetString() );
+ ::rtl::OUString sOldText( GetString() );
ClearPortionData();
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( rText != sOldText )
{
@@ -425,8 +414,8 @@ void SwAccessibleParagraph::_InvalidateContent( sal_Bool bVisibleDataFired )
if( bNewIsHeading != bOldIsHeading || rText != sOldText )
{
- OUString sNewDesc( GetDescription() );
- OUString sOldDesc;
+ ::rtl::OUString sNewDesc( GetDescription() );
+ ::rtl::OUString sOldDesc;
{
vos::OGuard aGuard( aMutex );
sOldDesc = sDesc;
@@ -503,19 +492,27 @@ void SwAccessibleParagraph::_InvalidateFocus()
}
SwAccessibleParagraph::SwAccessibleParagraph(
- SwAccessibleMap* pInitMap,
- const SwTxtFrm *pTxtFrm ) :
- SwAccessibleContext( pInitMap, AccessibleRole::PARAGRAPH, pTxtFrm ),
- pPortionData( NULL ),
- pHyperTextData( NULL ),
- nOldCaretPos( -1 ),
- aSelectionHelper( *this )
+ SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm )
+ // --> OD 2010-02-24 #i108125#
+ : SwClient( const_cast<SwTxtNode*>(rTxtFrm.GetTxtNode()) )
+ // <--
+ , SwAccessibleContext( &rInitMap, AccessibleRole::PARAGRAPH, &rTxtFrm )
+ , sDesc()
+ , pPortionData( NULL )
+ , pHyperTextData( NULL )
+ , nOldCaretPos( -1 )
+ , bIsHeading( sal_False )
+ , aSelectionHelper( *this )
+ // --> OD 2010-02-19 #i108125#
+ , mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) )
+ // <--
{
vos::OGuard aGuard(Application::GetSolarMutex());
bIsHeading = IsHeading();
// --> OD 2004-09-27 #117970# - set an empty accessibility name for paragraphs
- SetName( OUString() );
+ SetName( ::rtl::OUString() );
// <--
// If this object has the focus, then it is remembered by the map itself.
@@ -528,6 +525,9 @@ SwAccessibleParagraph::~SwAccessibleParagraph()
delete pPortionData;
delete pHyperTextData;
+ // --> OD 2010-02-22 #i108125#
+ delete mpParaChangeTrackInfo;
+ // <--
}
sal_Bool SwAccessibleParagraph::HasCursor()
@@ -648,8 +648,8 @@ sal_Bool SwAccessibleParagraph::IsValidRange(
sal_Bool SwAccessibleParagraph::GetCharBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
rBound.startPos = nPos;
@@ -658,8 +658,8 @@ sal_Bool SwAccessibleParagraph::GetCharBoundary(
}
sal_Bool SwAccessibleParagraph::GetWordBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
sal_Bool bRet = sal_False;
@@ -671,12 +671,12 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
- Locale aLocale = pBreakIt->GetLocale(
+ lang::Locale aLocale = pBreakIt->GetLocale(
GetTxtNode()->GetLang( nModelPos ) );
// which type of word are we interested in?
// (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
- const USHORT nWordType = WordType::ANY_WORD;
+ const USHORT nWordType = i18n::WordType::ANY_WORD;
// get word boundary, as the Break-Iterator sees fit.
rBound = pBreakIt->GetBreakIter()->getWordBoundary(
@@ -697,8 +697,8 @@ sal_Bool SwAccessibleParagraph::GetWordBoundary(
}
sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
GetPortionData().GetSentenceBoundary( rBound, nPos );
@@ -706,8 +706,8 @@ sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
}
sal_Bool SwAccessibleParagraph::GetLineBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
if( rText.getLength() == nPos )
@@ -718,8 +718,8 @@ sal_Bool SwAccessibleParagraph::GetLineBoundary(
}
sal_Bool SwAccessibleParagraph::GetParagraphBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 )
{
rBound.startPos = 0;
@@ -728,8 +728,8 @@ sal_Bool SwAccessibleParagraph::GetParagraphBoundary(
}
sal_Bool SwAccessibleParagraph::GetAttributeBoundary(
- Boundary& rBound,
- const OUString&,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString&,
sal_Int32 nPos )
{
GetPortionData().GetAttributeBoundary( rBound, nPos );
@@ -737,8 +737,8 @@ sal_Bool SwAccessibleParagraph::GetAttributeBoundary(
}
sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos )
{
sal_Bool bRet = sal_False;
@@ -751,11 +751,11 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
{
// get locale for this position
USHORT nModelPos = GetPortionData().GetModelPosition( nPos );
- Locale aLocale = pBreakIt->GetLocale(
+ lang::Locale aLocale = pBreakIt->GetLocale(
GetTxtNode()->GetLang( nModelPos ) );
// get word boundary, as the Break-Iterator sees fit.
- const USHORT nIterMode = CharacterIteratorMode::SKIPCELL;
+ const USHORT nIterMode = i18n::CharacterIteratorMode::SKIPCELL;
sal_Int32 nDone = 0;
rBound.endPos = pBreakIt->GetBreakIter()->nextCharacters(
rText, nPos, aLocale, nIterMode, 1, nDone );
@@ -777,20 +777,20 @@ sal_Bool SwAccessibleParagraph::GetGlyphBoundary(
sal_Bool SwAccessibleParagraph::GetTextBoundary(
- Boundary& rBound,
- const OUString& rText,
+ i18n::Boundary& rBound,
+ const ::rtl::OUString& rText,
sal_Int32 nPos,
sal_Int16 nTextType )
throw (
- IndexOutOfBoundsException,
- IllegalArgumentException,
+ lang::IndexOutOfBoundsException,
+ lang::IllegalArgumentException,
uno::RuntimeException)
{
// error checking
if( !( AccessibleTextType::LINE == nTextType
? IsValidPosition( nPos, rText.getLength() )
: IsValidChar( nPos, rText.getLength() ) ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
sal_Bool bRet;
@@ -825,13 +825,13 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
break;
default:
- throw IllegalArgumentException( );
+ throw lang::IllegalArgumentException( );
}
return bRet;
}
-OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -845,7 +845,7 @@ OUString SAL_CALL SwAccessibleParagraph::getAccessibleDescription (void)
return sDesc;
}
-Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
+lang::Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -857,7 +857,7 @@ Locale SAL_CALL SwAccessibleParagraph::getLocale (void)
}
const SwTxtNode *pTxtNd = pTxtFrm->GetTxtNode();
- Locale aLoc( pBreakIt->GetLocale( pTxtNd->GetLang( 0 ) ) );
+ lang::Locale aLoc( pBreakIt->GetLocale( pTxtNd->GetLang( 0 ) ) );
return aLoc;
}
@@ -1010,10 +1010,10 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground()
}
// <--
-OUString SAL_CALL SwAccessibleParagraph::getImplementationName()
+::rtl::OUString SAL_CALL SwAccessibleParagraph::getImplementationName()
throw( uno::RuntimeException )
{
- return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
}
sal_Bool SAL_CALL SwAccessibleParagraph::supportsService(
@@ -1026,13 +1026,13 @@ sal_Bool SAL_CALL SwAccessibleParagraph::supportsService(
sizeof(sAccessibleServiceName)-1 );
}
-Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
throw( uno::RuntimeException )
{
- Sequence< OUString > aRet(2);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
- pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
+ uno::Sequence< ::rtl::OUString > aRet(2);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
+ pArray[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
return aRet;
}
@@ -1040,10 +1040,10 @@ Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNames()
//===== XInterface =======================================================
//
-Any SwAccessibleParagraph::queryInterface( const Type& rType )
- throw (RuntimeException)
+uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType )
+ throw (uno::RuntimeException)
{
- Any aRet;
+ uno::Any aRet;
if ( rType == ::getCppuType((uno::Reference<XAccessibleText> *)0) )
{
uno::Reference<XAccessibleText> aAccText = (XAccessibleText *) *this; // resolve ambiguity
@@ -1095,9 +1095,9 @@ Any SwAccessibleParagraph::queryInterface( const Type& rType )
}
//====== XTypeProvider ====================================================
-Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeException)
+uno::Sequence< uno::Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(uno::RuntimeException)
{
- Sequence< Type > aTypes( SwAccessibleContext::getTypes() );
+ uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
sal_Int32 nIndex = aTypes.getLength();
// --> OD 2006-07-13 #i63870#
@@ -1106,7 +1106,7 @@ Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeExcepti
// add type accessibility::XAccessibleTextMarkup and accessibility::XAccessibleMultiLineText
aTypes.realloc( nIndex + 6 );
- Type* pTypes = aTypes.getArray();
+ uno::Type* pTypes = aTypes.getArray();
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleEditableText > * >( 0 ) );
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTextAttributes > * >( 0 ) );
pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
@@ -1118,11 +1118,11 @@ Sequence< Type > SAL_CALL SwAccessibleParagraph::getTypes() throw(RuntimeExcepti
return aTypes;
}
-Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
- throw(RuntimeException)
+uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
+ throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
- static Sequence< sal_Int8 > aId( 16 );
+ static uno::Sequence< sal_Int8 > aId( 16 );
static sal_Bool bInit = sal_False;
if(!bInit)
{
@@ -1138,7 +1138,7 @@ Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId()
//
sal_Int32 SwAccessibleParagraph::getCaretPosition()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1160,7 +1160,7 @@ sal_Int32 SwAccessibleParagraph::getCaretPosition()
}
sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1170,7 +1170,7 @@ sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidPosition( nIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Bool bRet = sal_False;
@@ -1193,13 +1193,13 @@ sal_Bool SAL_CALL SwAccessibleParagraph::setCaretPosition( sal_Int32 nIndex )
}
sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- OUString sText( GetString() );
+ ::rtl::OUString sText( GetString() );
// return character (if valid)
if( IsValidChar(nIndex, sText.getLength() ) )
@@ -1207,25 +1207,25 @@ sal_Unicode SwAccessibleParagraph::getCharacter( sal_Int32 nIndex )
return sText.getStr()[nIndex];
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
// --> OD 2006-07-20 #i63870#
// re-implement method on behalf of methods <_getDefaultAttributesImpl(..)> and
// <_getRunAttributesImpl(..)>
-Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
+uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
sal_Int32 nIndex,
const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( ! IsValidChar( nIndex, rText.getLength() ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
// retrieve default character attributes
tAccParaPropValMap aDefAttrSeq;
@@ -1236,7 +1236,7 @@ Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
_getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
// merge default and run attributes
- Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aDefIter = aDefAttrSeq.begin();
@@ -1354,7 +1354,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
const SfxPoolItem* pItem = pSet->GetItem( aPropIt->nWID );
if ( pItem )
{
- Any aVal;
+ uno::Any aVal;
pItem->QueryValue( aVal, aPropIt->nMemberId );
PropertyValue rPropVal;
@@ -1372,14 +1372,14 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// add property value entry for the paragraph style
if ( !bOnlyCharAttrs && pTxtNode->GetTxtColl() )
{
- const OUString sParaStyleName =
- OUString::createFromAscii(
+ const ::rtl::OUString sParaStyleName =
+ ::rtl::OUString::createFromAscii(
GetPropName( UNO_NAME_PARA_STYLE_NAME ).pName );
if ( aDefAttrSeq.find( sParaStyleName ) == aDefAttrSeq.end() )
{
PropertyValue rPropVal;
rPropVal.Name = sParaStyleName;
- Any aVal( makeAny( OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
+ uno::Any aVal( uno::makeAny( ::rtl::OUString( pTxtNode->GetTxtColl()->GetName() ) ) );
rPropVal.Value = aVal;
rPropVal.Handle = -1;
rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
@@ -1393,8 +1393,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// resolve value text::WritingMode2::PAGE of property value entry WritingMode
if ( !bOnlyCharAttrs && GetFrm() )
{
- const OUString sWritingMode =
- OUString::createFromAscii(
+ const ::rtl::OUString sWritingMode =
+ ::rtl::OUString::createFromAscii(
GetPropName( UNO_NAME_WRITING_MODE ).pName );
tAccParaPropValMap::iterator aIter = aDefAttrSeq.find( sWritingMode );
if ( aIter != aDefAttrSeq.end() )
@@ -1447,7 +1447,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
}
else
{
- const OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
const sal_Int32 nLength = aRequestedAttributes.getLength();
for( sal_Int32 i = 0; i < nLength; ++i )
{
@@ -1460,8 +1460,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
}
}
-Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
- const Sequence< ::rtl::OUString >& aRequestedAttributes )
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
throw ( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1470,7 +1470,30 @@ Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
tAccParaPropValMap aDefAttrSeq;
_getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
- Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
+ // --> OD 2010-03-08 #i92233#
+ static rtl::OUString sMMToPixelRatio( rtl::OUString::createFromAscii( "MMToPixelRatio" ) );
+ bool bProvideMMToPixelRatio( false );
+ {
+ if ( aRequestedAttributes.getLength() == 0 )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ else
+ {
+ const rtl::OUString* aRequestedAttrIter =
+ ::std::find( ::comphelper::stl_begin( aRequestedAttributes ),
+ ::comphelper::stl_end( aRequestedAttributes ),
+ sMMToPixelRatio );
+ if ( aRequestedAttrIter != ::comphelper::stl_end( aRequestedAttributes ) )
+ {
+ bProvideMMToPixelRatio = true;
+ }
+ }
+ }
+ // <--
+
+ uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() +
+ ( bProvideMMToPixelRatio ? 1 : 0 ) );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aIter = aDefAttrSeq.begin();
@@ -1481,6 +1504,21 @@ Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes(
++i;
}
+ // --> OD 2010-03-08 #i92233#
+ if ( bProvideMMToPixelRatio )
+ {
+ PropertyValue rPropVal;
+ rPropVal.Name = sMMToPixelRatio;
+ const Size a100thMMSize( 1000, 1000 );
+ const Size aPixelSize = GetMap()->LogicToPixel( a100thMMSize );
+ const float fRatio = ((float)a100thMMSize.Width()/100)/aPixelSize.Width();
+ rPropVal.Value = uno::makeAny( fRatio );
+ rPropVal.Handle = -1;
+ rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+ pValues[ aValues.getLength() - 1 ] = rPropVal;
+ }
+ // <--
+
return aValues;
}
@@ -1557,7 +1595,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
// the corresponding default character attributes, are excluded.
if ( aSet.GetItemState( aPropIt->nWID, TRUE, &pItem ) == SFX_ITEM_SET )
{
- Any aVal;
+ uno::Any aVal;
pItem->QueryValue( aVal, aPropIt->nMemberId );
PropertyValue rPropVal;
@@ -1585,7 +1623,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
}
else
{
- const OUString* pReqAttrs = aRequestedAttributes.getConstArray();
+ const ::rtl::OUString* pReqAttrs = aRequestedAttributes.getConstArray();
const sal_Int32 nLength = aRequestedAttributes.getLength();
for( sal_Int32 i = 0; i < nLength; ++i )
{
@@ -1601,27 +1639,27 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
delete pPaM;
}
-Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
+uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
sal_Int32 nIndex,
- const Sequence< ::rtl::OUString >& aRequestedAttributes )
- throw ( IndexOutOfBoundsException,
+ const uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
{
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if ( !IsValidChar( nIndex, rText.getLength() ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
}
tAccParaPropValMap aRunAttrSeq;
_getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
- Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
+ uno::Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
PropertyValue* pValues = aValues.getArray();
sal_Int32 i = 0;
for ( tAccParaPropValMap::const_iterator aIter = aRunAttrSeq.begin();
@@ -1638,7 +1676,7 @@ Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1649,7 +1687,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
IsValidChar -> IsValidPosition
*/
if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
/* #i12332# */
sal_Bool bBehindText = sal_False;
@@ -1689,7 +1727,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() ));
- SwRect aFrmLogBounds( GetBounds() ); // twip rel to doc root
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
@@ -1701,7 +1739,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
}
sal_Int32 SwAccessibleParagraph::getCharacterCount()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1711,7 +1749,7 @@ sal_Int32 SwAccessibleParagraph::getCharacterCount()
}
sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1727,7 +1765,7 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
Window *pWin = GetWindow();
CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
Point aPoint( rPoint.X, rPoint.Y );
- SwRect aLogBounds( GetBounds( GetFrm() ) ); // twip rel to doc root
+ SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
aPoint.X() += aPixPos.X();
aPoint.Y() += aPixPos.Y();
@@ -1787,8 +1825,8 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
: -1L;
}
-OUString SwAccessibleParagraph::getSelectedText()
- throw (RuntimeException)
+::rtl::OUString SwAccessibleParagraph::getSelectedText()
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1796,11 +1834,13 @@ OUString SwAccessibleParagraph::getSelectedText()
sal_Int32 nStart, nEnd;
sal_Bool bSelected = GetSelection( nStart, nEnd );
- return bSelected ? GetString().copy( nStart, nEnd - nStart ) : OUString();
+ return bSelected
+ ? GetString().copy( nStart, nEnd - nStart )
+ : ::rtl::OUString();
}
sal_Int32 SwAccessibleParagraph::getSelectionStart()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1812,7 +1852,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionStart()
}
sal_Int32 SwAccessibleParagraph::getSelectionEnd()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1824,7 +1864,7 @@ sal_Int32 SwAccessibleParagraph::getSelectionEnd()
}
sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1834,7 +1874,7 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidRange( nStartIndex, nEndIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Bool bRet = sal_False;
@@ -1859,8 +1899,8 @@ sal_Bool SwAccessibleParagraph::setSelection( sal_Int32 nStartIndex, sal_Int32 n
return bRet;
}
-OUString SwAccessibleParagraph::getText()
- throw (RuntimeException)
+::rtl::OUString SwAccessibleParagraph::getText()
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1869,15 +1909,15 @@ OUString SwAccessibleParagraph::getText()
return GetString();
}
-OUString SwAccessibleParagraph::getTextRange(
+::rtl::OUString SwAccessibleParagraph::getTextRange(
sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- OUString sText( GetString() );
+ ::rtl::OUString sText( GetString() );
if ( IsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
{
@@ -1885,7 +1925,7 @@ OUString SwAccessibleParagraph::getTextRange(
return sText.copy(nStartIndex, nEndIndex-nStartIndex );
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
/*accessibility::*/TextSegment SwAccessibleParagraph::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
@@ -1898,7 +1938,7 @@ OUString SwAccessibleParagraph::getTextRange(
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
// implement the silly specification that first position after
// text must return an empty string, rather than throwing an
// IndexOutOfBoundsException, except for LINE, where the last
@@ -1907,7 +1947,7 @@ OUString SwAccessibleParagraph::getTextRange(
return aResult;
// with error checking
- Boundary aBound;
+ i18n::Boundary aBound;
sal_Bool bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
DBG_ASSERT( aBound.startPos >= 0, "illegal boundary" );
@@ -1930,14 +1970,14 @@ OUString SwAccessibleParagraph::getTextRange(
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
// get starting pos
- Boundary aBound;
+ i18n::Boundary aBound;
if (nIndex == rText.getLength())
aBound.startPos = aBound.endPos = nIndex;
else
@@ -1977,7 +2017,7 @@ OUString SwAccessibleParagraph::getTextRange(
/*accessibility::*/TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
- const OUString rText = GetString();
+ const ::rtl::OUString rText = GetString();
// implement the silly specification that first position after
// text must return an empty string, rather than throwing an
@@ -1987,7 +2027,7 @@ OUString SwAccessibleParagraph::getTextRange(
// get first word, then skip to next word
- Boundary aBound;
+ i18n::Boundary aBound;
GetTextBoundary( aBound, rText, nIndex, nTextType );
sal_Bool bWord = sal_False;
while( !bWord )
@@ -2009,7 +2049,7 @@ OUString SwAccessibleParagraph::getTextRange(
}
sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2026,7 +2066,7 @@ sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
//
sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleEditableText );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2041,7 +2081,7 @@ sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIn
}
sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleEditableText );
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2056,27 +2096,27 @@ sal_Bool SwAccessibleParagraph::pasteText( sal_Int32 nIndex )
}
sal_Bool SwAccessibleParagraph::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- return replaceText( nStartIndex, nEndIndex, OUString() );
+ return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() );
}
-sal_Bool SwAccessibleParagraph::insertText( const OUString& sText, sal_Int32 nIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+sal_Bool SwAccessibleParagraph::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
return replaceText( nIndex, nIndex, sText );
}
sal_Bool SwAccessibleParagraph::replaceText(
sal_Int32 nStartIndex, sal_Int32 nEndIndex,
- const OUString& sReplacement )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ const ::rtl::OUString& sReplacement )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleEditableText );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
{
@@ -2114,7 +2154,7 @@ sal_Bool SwAccessibleParagraph::replaceText(
return bSuccess;
}
else
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
struct IndexCompare
@@ -2131,16 +2171,16 @@ struct IndexCompare
sal_Bool SwAccessibleParagraph::setAttributes(
sal_Int32 nStartIndex,
sal_Int32 nEndIndex,
- const Sequence<PropertyValue>& rAttributeSet )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ const uno::Sequence<PropertyValue>& rAttributeSet )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleEditableText );
- const OUString& rText = GetString();
+ const ::rtl::OUString& rText = GetString();
if( ! IsValidRange( nStartIndex, nEndIndex, rText.getLength() ) )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
if( !IsEditableState() )
return sal_False;
@@ -2161,10 +2201,10 @@ sal_Bool SwAccessibleParagraph::setAttributes(
sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
// create sorted sequences accoring to index array
- Sequence<OUString> aNames( nLength );
- OUString* pNames = aNames.getArray();
- Sequence<Any> aValues( nLength );
- Any* pValues = aValues.getArray();
+ uno::Sequence< ::rtl::OUString > aNames( nLength );
+ ::rtl::OUString* pNames = aNames.getArray();
+ uno::Sequence< uno::Any > aValues( nLength );
+ uno::Any* pValues = aValues.getArray();
for( i = 0; i < nLength; i++ )
{
const PropertyValue& rVal = pPairs[pIndices[i]];
@@ -2188,8 +2228,8 @@ sal_Bool SwAccessibleParagraph::setAttributes(
return bRet;
}
-sal_Bool SwAccessibleParagraph::setText( const OUString& sText )
- throw (RuntimeException)
+sal_Bool SwAccessibleParagraph::setText( const ::rtl::OUString& sText )
+ throw (uno::RuntimeException)
{
return replaceText(0, GetString().getLength(), sText);
}
@@ -2198,7 +2238,7 @@ sal_Bool SwAccessibleParagraph::setText( const OUString& sText )
void SwAccessibleParagraph::selectAccessibleChild(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2208,7 +2248,7 @@ void SwAccessibleParagraph::selectAccessibleChild(
sal_Bool SwAccessibleParagraph::isAccessibleChildSelected(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2242,7 +2282,7 @@ sal_Int32 SwAccessibleParagraph::getSelectedAccessibleChildCount( )
uno::Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild(
sal_Int32 nSelectedChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException)
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2253,7 +2293,7 @@ uno::Reference<XAccessible> SwAccessibleParagraph::getSelectedAccessibleChild(
// --> OD 2004-11-16 #111714# - index has to be treated as global child index.
void SwAccessibleParagraph::deselectAccessibleChild(
sal_Int32 nChildIndex )
- throw ( IndexOutOfBoundsException,
+ throw ( lang::IndexOutOfBoundsException,
uno::RuntimeException )
{
CHECK_FOR_DEFUNC( XAccessibleSelection );
@@ -2315,7 +2355,7 @@ const SwTxtAttr *SwHyperlinkIter_Impl::next()
};
sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
- throw (RuntimeException)
+ throw (uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -2337,7 +2377,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkCount()
uno::Reference< XAccessibleHyperlink > SAL_CALL
SwAccessibleParagraph::getHyperLink( sal_Int32 nLinkIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleHypertext );
@@ -2386,13 +2426,13 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
}
if( !xRet.is() )
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
return xRet;
}
sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharIndex )
- throw (IndexOutOfBoundsException, uno::RuntimeException)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
CHECK_FOR_DEFUNC( XAccessibleHypertext );
@@ -2401,7 +2441,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidPosition( nCharIndex, nLength ) )
{
- throw IndexOutOfBoundsException();
+ throw lang::IndexOutOfBoundsException();
}
sal_Int32 nRet = -1;
@@ -2430,13 +2470,30 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
}
// --> OD 2008-05-26 #i71360#
+// --> OD 2010-02-22 #i108125# - adjustments for change tracking text markup
sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMarkupType )
throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkupCount( nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
}
/*accessibility::*/TextSegment SAL_CALL
@@ -2446,9 +2503,25 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getTextMarkupCount( sal_Int32 nTextMar
lang::IllegalArgumentException,
uno::RuntimeException)
{
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
}
uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL
@@ -2465,9 +2538,25 @@ uno::Sequence< /*accessibility::*/TextSegment > SAL_CALL
throw lang::IndexOutOfBoundsException();
}
- SwTextMarkupHelper aTextMarkupHelper( *GetTxtNode(), GetPortionData() );
+ std::auto_ptr<SwTextMarkupHelper> pTextMarkupHelper;
+ switch ( nTextMarkupType )
+ {
+ case text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ case text::TextMarkupType::TRACK_CHANGE_DELETION:
+ case text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper(
+ GetPortionData(),
+ *(mpParaChangeTrackInfo->getChangeTrackingTextMarkupList( nTextMarkupType ) )) );
+ }
+ break;
+ default:
+ {
+ pTextMarkupHelper.reset( new SwTextMarkupHelper( GetPortionData(), *GetTxtNode() ) );
+ }
+ }
- return aTextMarkupHelper.getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
+ return pTextMarkupHelper->getTextMarkupAtIndex( nCharIndex, nTextMarkupType );
}
// <--
@@ -2499,7 +2588,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getLineNumberAtIndex( sal_Int32 nIndex
throw lang::IndexOutOfBoundsException();
}
- Boundary aLineBound;
+ i18n::Boundary aLineBound;
GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
/*accessibility::*/TextSegment aTextAtLine;
@@ -2541,7 +2630,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
// special handling for cursor positioned at end of text line via End key
if ( nCaretPos != 0 )
{
- Boundary aLineBound;
+ i18n::Boundary aLineBound;
GetPortionData().GetBoundaryOfLine( nLineNo, aLineBound );
if ( nCaretPos == aLineBound.startPos )
{
@@ -2557,7 +2646,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() ));
- SwRect aFrmLogBounds( GetBounds() ); // twip rel to doc root
+ SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
@@ -2579,4 +2668,11 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
return nLineNo;
}
+// --> OD 2010-02-19 #i108125#
+void SwAccessibleParagraph::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ mpParaChangeTrackInfo->reset();
+
+ SwClient::Modify( pOld, pNew );
+}
// <--
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index 1a745d8af01e..7e07fa132d05 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -26,24 +26,19 @@
************************************************************************/
#ifndef _ACCPARA_HXX
#define _ACCPARA_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
-// --> OD 2008-05-19 #i71360#
#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
-// <--
-// --> OD 2008-05-29 #i89175#
#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
-// <--
-
-// --> OD 2006-07-11 #i63870#
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <hash_map>
+#include <accselectionhelper.hxx>
+// --> OD 2010-02-19 #i108125#
+#include <calbck.hxx>
// <--
-#include "accselectionhelper.hxx"
class SwTxtFrm;
class SwTxtNode;
@@ -51,6 +46,10 @@ class SwPaM;
class SwAccessiblePortionData;
class SwAccessibleHyperTextData;
class SwXTextPortion;
+// --> OD 2010-02-19 #i108125#
+class SwParaChangeTrackingInfo;
+// <--
+
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
namespace i18n { struct Boundary; }
@@ -63,19 +62,16 @@ typedef ::std::hash_map< ::rtl::OUString,
::std::equal_to< ::rtl::OUString > > tAccParaPropValMap;
class SwAccessibleParagraph :
+ // --> OD 2010-02-19 #i108125#
+ public SwClient,
+ // <--
public SwAccessibleContext,
public ::com::sun::star::accessibility::XAccessibleEditableText,
public com::sun::star::accessibility::XAccessibleSelection,
public com::sun::star::accessibility::XAccessibleHypertext,
- // --> OD 2008-05-19 #i71360#
public com::sun::star::accessibility::XAccessibleTextMarkup,
- // <--
- // --> OD 2008-05-29 #i89175#
public com::sun::star::accessibility::XAccessibleMultiLineText,
- // <--
- // --> OD 2006-07-11 #i63870#
public ::com::sun::star::accessibility::XAccessibleTextAttributes
- // <--
{
friend class SwAccessibleHyperlink;
@@ -98,6 +94,9 @@ class SwAccessibleParagraph :
// implementation for XAccessibleSelection
SwAccessibleSelectionHelper aSelectionHelper;
+ // --> OD 2010-02-19 #i108125#
+ SwParaChangeTrackingInfo* mpParaChangeTrackInfo;
+ // <--
/// get the SwTxtNode (requires frame; check before)
const SwTxtNode* GetTxtNode() const;
@@ -237,13 +236,17 @@ protected:
public:
- SwAccessibleParagraph( SwAccessibleMap* pInitMap,
- const SwTxtFrm *pTxtFrm );
+ SwAccessibleParagraph( SwAccessibleMap& rInitMap,
+ const SwTxtFrm& rTxtFrm );
inline operator ::com::sun::star::accessibility::XAccessibleText *();
virtual sal_Bool HasCursor(); // required by map to remember that object
+ // --> OD 2010-02-19 #i108125#
+ virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew);
+ // <--
+
//===== XAccessibleContext ==============================================
/// Return this object's description.
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
index 31f05063263e..8e4593377c63 100644
--- a/sw/source/core/access/accselectionhelper.cxx
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -32,15 +32,14 @@
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <accselectionhelper.hxx>
-#ifndef _ACCCONTEXT_HXX
#include <acccontext.hxx>
-#endif
#include <accmap.hxx>
#include <svx/AccessibleShape.hxx>
#include <viewsh.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <vcl/svapp.hxx> // for SolarMutex
#include <tools/debug.hxx>
+#include <flyfrm.hxx>
using namespace ::com::sun::star;
@@ -50,7 +49,7 @@ using ::com::sun::star::accessibility::XAccessible;
using ::com::sun::star::accessibility::XAccessibleContext;
using ::com::sun::star::accessibility::XAccessibleSelection;
-
+using namespace ::sw::access;
SwAccessibleSelectionHelper::SwAccessibleSelectionHelper(
SwAccessibleContext& rCtxt ) :
@@ -100,7 +99,8 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
vos::OGuard aGuard(Application::GetSolarMutex());
// Get the respective child as SwFrm (also do index checking), ...
- const SwFrmOrObj aChild = rContext.GetChild( nChildIndex );
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
@@ -110,7 +110,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
SwFEShell* pFEShell = GetFEShell();
if( pFEShell != NULL )
{
- const SdrObject *pObj = aChild.GetSdrObject();
+ const SdrObject *pObj = aChild.GetDrawObject();
if( pObj )
{
bRet = rContext.Select( const_cast< SdrObject *>( pObj ), 0==aChild.GetSwFrm());
@@ -129,7 +129,8 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
vos::OGuard aGuard(Application::GetSolarMutex());
// Get the respective child as SwFrm (also do index checking), ...
- const SwFrmOrObj aChild = rContext.GetChild( nChildIndex );
+ const SwAccessibleChild aChild = rContext.GetChild( *(rContext.GetMap()),
+ nChildIndex );
if( !aChild.IsValid() )
throwIndexOutOfBoundsException();
@@ -138,13 +139,13 @@ sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
SwFEShell* pFEShell = GetFEShell();
if( pFEShell )
{
- if( aChild.GetSwFrm() != 0 )
+ if ( aChild.GetSwFrm() != 0 )
{
bRet = (pFEShell->GetCurrFlyFrm() == aChild.GetSwFrm());
}
- else
+ else if ( aChild.GetDrawObject() )
{
- bRet = pFEShell->IsObjSelected( *aChild.GetSdrObject() );
+ bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
}
}
@@ -168,15 +169,15 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( )
SwFEShell* pFEShell = GetFEShell();
if( pFEShell )
{
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter = aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter = aChildren.end();
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
while( aIter != aEndIter )
{
- const SwFrmOrObj& rChild = *aIter;
- const SdrObject *pObj = rChild.GetSdrObject();
+ const SwAccessibleChild& rChild = *aIter;
+ const SdrObject* pObj = rChild.GetDrawObject();
const SwFrm* pFrm = rChild.GetSwFrm();
if( pObj && !(pFrm != 0 && pFEShell->IsObjSelected()) )
{
@@ -200,11 +201,11 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
SwFEShell* pFEShell = GetFEShell();
if( pFEShell != 0 )
{
- const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
+ const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
- if( rContext.GetParent(pFlyFrm, rContext.IsInPagePreview()) ==
- rContext.GetFrm() )
+ if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+ rContext.GetFrm() )
{
nCount = 1;
}
@@ -214,20 +215,20 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( )
sal_uInt16 nSelObjs = pFEShell->IsObjSelected();
if( nSelObjs > 0 )
{
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter =
+ ::std::list< SwAccessibleChild >::const_iterator aIter =
aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter =
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter =
aChildren.end();
while( aIter != aEndIter && nCount < nSelObjs )
{
- const SwFrmOrObj& rChild = *aIter;
- if( rChild.GetSdrObject() && !rChild.GetSwFrm() &&
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
rContext.GetParent(rChild, rContext.IsInPagePreview())
== rContext.GetFrm() &&
- pFEShell->IsObjSelected( *rChild.GetSdrObject() ) )
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
{
nCount++;
}
@@ -254,12 +255,12 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
if( 0 == pFEShell )
throwIndexOutOfBoundsException();
- SwFrmOrObj aChild;
+ SwAccessibleChild aChild;
const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
if( pFlyFrm )
{
if( 0 == nSelectedChildIndex &&
- rContext.GetParent(pFlyFrm, rContext.IsInPagePreview()) ==
+ rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
rContext.GetFrm() )
{
aChild = pFlyFrm;
@@ -271,18 +272,18 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
if( 0 == nSelObjs || nSelectedChildIndex >= nSelObjs )
throwIndexOutOfBoundsException();
- ::std::list< SwFrmOrObj > aChildren;
- rContext.GetChildren( aChildren );
+ ::std::list< SwAccessibleChild > aChildren;
+ rContext.GetChildren( *(rContext.GetMap()), aChildren );
- ::std::list< SwFrmOrObj >::const_iterator aIter = aChildren.begin();
- ::std::list< SwFrmOrObj >::const_iterator aEndIter = aChildren.end();
+ ::std::list< SwAccessibleChild >::const_iterator aIter = aChildren.begin();
+ ::std::list< SwAccessibleChild >::const_iterator aEndIter = aChildren.end();
while( aIter != aEndIter && !aChild.IsValid() )
{
- const SwFrmOrObj& rChild = *aIter;
- if( rChild.GetSdrObject() && !rChild.GetSwFrm() &&
+ const SwAccessibleChild& rChild = *aIter;
+ if( rChild.GetDrawObject() && !rChild.GetSwFrm() &&
rContext.GetParent(rChild, rContext.IsInPagePreview()) ==
rContext.GetFrm() &&
- pFEShell->IsObjSelected( *rChild.GetSdrObject() ) )
+ pFEShell->IsObjSelected( *rChild.GetDrawObject() ) )
{
if( 0 == nSelectedChildIndex )
aChild = rChild;
@@ -309,10 +310,10 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
xChild = xChildImpl.getBodyPtr();
}
}
- else
+ else if ( aChild.GetDrawObject() )
{
::vos::ORef < ::accessibility::AccessibleShape > xChildImpl(
- rContext.GetMap()->GetContextImpl( aChild.GetSdrObject(),
+ rContext.GetMap()->GetContextImpl( aChild.GetDrawObject(),
&rContext, sal_True ) );
if( xChildImpl.isValid() )
xChild = xChildImpl.getBodyPtr();
@@ -328,6 +329,6 @@ void SwAccessibleSelectionHelper::deselectAccessibleChild(
{
// return sal_False // we can't deselect
if( nChildIndex < 0 ||
- nChildIndex >= rContext.GetChildCount() )
+ nChildIndex >= rContext.GetChildCount( *(rContext.GetMap()) ) )
throwIndexOutOfBoundsException();
}
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 667319058fa1..43befb2a3f86 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -42,26 +42,25 @@
#include <vcl/svapp.hxx>
#include <frmfmt.hxx>
#include <tabfrm.hxx>
-// --> OD 2007-06-27 #i77106#
#include <rowfrm.hxx>
-// <--
#include <cellfrm.hxx>
#include <swtable.hxx>
-#include "crsrsh.hxx"
-#include "viscrs.hxx"
+#include <crsrsh.hxx>
+#include <viscrs.hxx>
#include <hints.hxx>
-#include "fesh.hxx"
+#include <fesh.hxx>
#include <accfrmobjslist.hxx>
-#include "accmap.hxx"
-#ifndef _ACCESS_HRC
-#include "access.hrc"
-#endif
+#include <accmap.hxx>
+#include <access.hrc>
#include <acctable.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using namespace ::sw::access;
const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView";
const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTableView";
@@ -83,15 +82,14 @@ public:
class SwAccessibleTableData_Impl
{
+ SwAccessibleMap& mrAccMap;
Int32Set_Impl maRows;
Int32Set_Impl maColumns;
Int32PairList_Impl maExtents; // cell extends for event processing only
Point maTabFrmPos;
const SwTabFrm *mpTabFrm;
sal_Bool mbIsInPagePreview;
- // --> OD 2007-06-27 #i77106#
bool mbOnlyTableColumnHeader;
- // <--
void CollectData( const SwFrm *pFrm );
void CollectExtents( const SwFrm *pFrm );
@@ -114,7 +112,8 @@ class SwAccessibleTableData_Impl
public:
// --> OD 2007-06-27 #i77106#
// add third optional parameter <bOnlyTableColumnHeader>, default value <false>
- SwAccessibleTableData_Impl( const SwTabFrm *pTabFrm,
+ SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
sal_Bool bIsInPagePreview,
bool bOnlyTableColumnHeader = false );
// <--
@@ -154,12 +153,12 @@ public:
void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -189,12 +188,12 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
if( pLower )
{
@@ -230,12 +229,12 @@ sal_Bool SwAccessibleTableData_Impl::FindCell(
{
sal_Bool bFound = sal_False;
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( !bFound && aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
ASSERT( pLower, "child should be a frame" );
if( pLower )
@@ -282,15 +281,15 @@ void SwAccessibleTableData_Impl::GetSelection(
SwAccTableSelHander_Impl& rSelHdl,
sal_Bool bColumns ) const
{
- const SwFrmOrObjSList aList( pFrm );
- SwFrmOrObjSList::const_iterator aIter( aList.begin() );
- SwFrmOrObjSList::const_iterator aEndIter( aList.end() );
+ const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+ SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+ SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
while( aIter != aEndIter )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
const SwFrm *pLower = rLower.GetSwFrm();
ASSERT( pLower, "child should be a frame" );
- const SwRect& rBox = rLower.GetBox();
+ const SwRect& rBox = rLower.GetBox( mrAccMap );
if( pLower && rBox.IsOver( rArea ) )
{
if( rLower.IsAccessible( mbIsInPagePreview ) )
@@ -430,15 +429,15 @@ sal_Bool SwAccessibleTableData_Impl::CompareExtents(
return sal_True;
}
-SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( const SwTabFrm *pTabFrm,
+SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
+ const SwTabFrm *pTabFrm,
sal_Bool bIsInPagePreview,
bool bOnlyTableColumnHeader )
- : maTabFrmPos( pTabFrm->Frm().Pos() ),
- mpTabFrm( pTabFrm ),
- mbIsInPagePreview( bIsInPagePreview ),
- // --> OD 2007-06-27 #i77106#
- mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
- // <--
+ : mrAccMap( rAccMap )
+ , maTabFrmPos( pTabFrm->Frm().Pos() )
+ , mpTabFrm( pTabFrm )
+ , mbIsInPagePreview( bIsInPagePreview )
+ , mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
{
CollectData( mpTabFrm );
CollectExtents( mpTabFrm );
@@ -641,7 +640,7 @@ const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int32 nChildIndex ) const
const SwTableBox* pBox = NULL;
// get table box for 'our' table cell
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
+ SwAccessibleChild aCell( GetChild( *(const_cast<SwAccessibleMap*>(GetMap())), nChildIndex ) );
if( aCell.GetSwFrm() )
{
const SwFrm* pChildFrm = aCell.GetSwFrm();
@@ -855,7 +854,7 @@ uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
SwAccessibleTableData_Impl* SwAccessibleTable::CreateNewTableData()
{
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- return new SwAccessibleTableData_Impl( pTabFrm, IsInPagePreview() );
+ return new SwAccessibleTableData_Impl( *GetMap(), pTabFrm, IsInPagePreview() );
}
// <--
@@ -907,24 +906,72 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription(
sal_Int32 nRow )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- // TODO: Is there any reasonable we can do here?
- OUString sTmpDesc;
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in <nRow>th row and in first column of row header table
+ // and return its text content.
+ OUString sRowDesc;
GetTableData().CheckRowAndCol(nRow, 0, this);
- return sTmpDesc;
+ uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
+ if ( xTableRowHeader.is() )
+ {
+ uno::Reference< XAccessible > xRowHeaderCell =
+ xTableRowHeader->getAccessibleCellAt( nRow, 0 );
+ ASSERT( xRowHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xRowHeaderCellContext =
+ xRowHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sRowDesc = sRowDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sRowDesc;
+ // <--
}
OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription(
sal_Int32 nColumn )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- // TODO: Is there any reasonable we can do here?
- OUString sTmpDesc;
+ // --> OD 2010-03-10 #i87532#
+ // determine table cell in first row and in <nColumn>th column of column header table
+ // and return its text content.
+ OUString sColumnDesc;
GetTableData().CheckRowAndCol(0, nColumn, this);
- return sTmpDesc;
+ uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
+ if ( xTableColumnHeader.is() )
+ {
+ uno::Reference< XAccessible > xColumnHeaderCell =
+ xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
+ ASSERT( xColumnHeaderCell.is(),
+ "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
+ uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
+ xColumnHeaderCell->getAccessibleContext();
+ const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
+ for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
+ {
+ uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
+ uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
+ if ( xChildText.is() )
+ {
+ sColumnDesc = sColumnDesc + xChildText->getText();
+ }
+ }
+ }
+
+ return sColumnDesc;
+ // <--
}
sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
@@ -1001,9 +1048,18 @@ uno::Reference< XAccessibleTable > SAL_CALL
SwAccessibleTable::getAccessibleColumnHeaders( )
throw (uno::RuntimeException)
{
- // --> OD 2007-06-29 #i77106#
- return new SwAccessibleTableColHeaders(
- GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
+ // --> OD 2010-03-10 #i87532#
+ // assure that return accesible object is empty, if no column header exists.
+ SwAccessibleTableColHeaders* pTableColHeaders =
+ new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
+ uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
+ if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
+ {
+ return uno::Reference< XAccessibleTable >();
+ }
+
+ return xTableColumnHeaders;
+ // <--
}
uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
@@ -1176,9 +1232,11 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
CHECK_FOR_DEFUNC( XAccessibleTable )
- SwFrmOrObj aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
- if( aCell.IsValid() )
- nRet = GetChildIndex( aCell );
+ SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
+ if ( aCell.IsValid() )
+ {
+ nRet = GetChildIndex( *(GetMap()), aCell );
+ }
return nRet;
}
@@ -1200,8 +1258,8 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
}
// <--
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
- if( aCell.GetSwFrm() )
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
{
sal_Int32 nTop = aCell.GetSwFrm()->Frm().Top();
nTop -= GetFrm()->Frm().Top();
@@ -1239,8 +1297,8 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
}
// <--
- SwFrmOrObj aCell( GetChild( nChildIndex ) );
- if( aCell.GetSwFrm() )
+ SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
+ if ( aCell.GetSwFrm() )
{
sal_Int32 nLeft = aCell.GetSwFrm()->Frm().Left();
nLeft -= GetFrm()->Frm().Left();
@@ -1307,8 +1365,8 @@ void SwAccessibleTable::Dispose( sal_Bool bRecursive )
SwAccessibleContext::Dispose( bRecursive );
}
-void SwAccessibleTable::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
- sal_Bool bRecursive )
+void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
+ sal_Bool bRecursive )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1330,7 +1388,7 @@ void SwAccessibleTable::DisposeChild( const SwFrmOrObj& rChildFrmOrObj,
SwAccessibleContext::DisposeChild( rChildFrmOrObj, bRecursive );
}
-void SwAccessibleTable::InvalidateChildPosOrSize( const SwFrmOrObj& rChildFrmOrObj,
+void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrmOrObj,
const SwRect& rOldBox )
{
vos::OGuard aGuard(Application::GetSolarMutex());
@@ -1358,15 +1416,9 @@ void SwAccessibleTable::InvalidateChildPosOrSize( const SwFrmOrObj& rChildFrmOrO
}
}
- // There are two reason why this method has been called. The first one
- // is there is no context for pFrm. The method is them called by
- // the map, and we have to call our superclass.
- // The other situation is that we have been call by a call to get notified
- // about its change. We then must not call the superclass
- ASSERT( rChildFrmOrObj.GetSwFrm(), "frame expected" );
- uno::Reference< XAccessible > xAcc( GetMap()->GetContext( rChildFrmOrObj.GetSwFrm(), sal_False ) );
- if( !xAcc.is() )
- SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
+ // --> OD 2010-02-18 #i013961# - always call super class method
+ SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
+ // <--
}
@@ -1661,7 +1713,7 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2
SwAccessibleTableData_Impl* SwAccessibleTableColHeaders::CreateNewTableData()
{
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- return new SwAccessibleTableData_Impl( pTabFrm, IsInPagePreview(), true );
+ return new SwAccessibleTableData_Impl( *(GetMap()), pTabFrm, IsInPagePreview(), true );
}
@@ -1687,11 +1739,11 @@ sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
sal_Int32 nCount = 0;
const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
- const SwFrmOrObjSList aVisList( GetVisArea(), pTabFrm );
- SwFrmOrObjSList::const_iterator aIter( aVisList.begin() );
+ const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrm, *(GetMap()) );
+ SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
while( aIter != aVisList.end() )
{
- const SwFrmOrObj& rLower = *aIter;
+ const SwAccessibleChild& rLower = *aIter;
if( rLower.IsAccessible( IsInPagePreview() ) )
{
nCount++;
@@ -1702,7 +1754,8 @@ sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
if ( !rLower.GetSwFrm()->IsRowFrm() ||
pTabFrm->IsInHeadline( *(rLower.GetSwFrm()) ) )
{
- nCount += SwAccessibleFrame::GetChildCount( GetVisArea(),
+ nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
+ GetVisArea(),
rLower.GetSwFrm(),
IsInPagePreview() );
}
diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx
index d874c86bcf3b..8bdf2e8b49b2 100644
--- a/sw/source/core/access/acctable.hxx
+++ b/sw/source/core/access/acctable.hxx
@@ -29,13 +29,16 @@
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+#include <acccontext.hxx>
class SwTabFrm;
class SwAccessibleTableData_Impl;
class SwTableBox;
+class SwSelBoxes;
+
+namespace sw { namespace access {
+ class SwAccessibleChild;
+} }
class SwAccessibleTable :
public SwAccessibleContext,
@@ -218,9 +221,10 @@ public:
// The object is not visible an longer and should be destroyed
virtual void Dispose( sal_Bool bRecursive = sal_False );
- virtual void DisposeChild( const SwFrmOrObj& rFrmOrObj, sal_Bool bRecursive );
- virtual void InvalidateChildPosOrSize( const SwFrmOrObj& rFrmOrObj,
- const SwRect& rFrm );
+ virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
+ sal_Bool bRecursive );
+ virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
+ const SwRect& rFrm );
//===== XAccessibleSelection ============================================
diff --git a/sw/source/core/access/makefile.mk b/sw/source/core/access/makefile.mk
index 20ffdad32118..72871314f722 100644
--- a/sw/source/core/access/makefile.mk
+++ b/sw/source/core/access/makefile.mk
@@ -63,7 +63,8 @@ SLOFILES = \
$(SLO)$/accselectionhelper.obj \
$(SLO)$/acctable.obj \
$(SLO)$/acctextframe.obj \
- $(SLO)$/textmarkuphelper.obj
+ $(SLO)$/textmarkuphelper.obj \
+ $(SLO)$/parachangetrackinginfo.obj
EXCEPTIONSFILES= \
$(SLO)$/acccell.obj \
@@ -89,7 +90,8 @@ EXCEPTIONSFILES= \
$(SLO)$/accselectionhelper.obj \
$(SLO)$/acctable.obj \
$(SLO)$/acctextframe.obj \
- $(SLO)$/textmarkuphelper.obj
+ $(SLO)$/textmarkuphelper.obj \
+ $(SLO)$/parachangetrackinginfo.obj
# --- Targets -------------------------------------------------------
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
new file mode 100644
index 000000000000..7c1e25f05c93
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <parachangetrackinginfo.hxx>
+
+#include <errhdl.hxx>
+#include <wrong.hxx>
+#include <com/sun/star/text/TextMarkupType.hpp>
+
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <IDocumentRedlineAccess.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+
+namespace css = com::sun::star;
+
+namespace {
+ void initChangeTrackTextMarkupLists( const SwTxtFrm& rTxtFrm,
+ SwWrongList*& opChangeTrackInsertionTextMarkupList,
+ SwWrongList*& opChangeTrackDeletionTextMarkupList,
+ SwWrongList*& opChangeTrackFormatChangeTextMarkupList )
+ {
+ opChangeTrackInsertionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackDeletionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+ opChangeTrackFormatChangeTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
+
+ if ( !rTxtFrm.GetTxtNode() )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <SwTxtNode> instance!" );
+ return;
+ }
+ const SwTxtNode& rTxtNode( *(rTxtFrm.GetTxtNode()) );
+
+ const IDocumentRedlineAccess* pIDocChangeTrack( rTxtNode.getIDocumentRedlineAccess() );
+ if ( !pIDocChangeTrack )
+ {
+ ASSERT( false,
+ "<initChangeTrackTextMarkupLists(..) - missing <IDocumentRedlineAccess> instance!" );
+ return;
+ }
+
+ if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) ||
+ pIDocChangeTrack->GetRedlineTbl().Count() == 0 )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const sal_uInt16 nIdxOfFirstRedlineForTxtNode =
+ pIDocChangeTrack->GetRedlinePos( rTxtNode, USHRT_MAX );
+ if ( nIdxOfFirstRedlineForTxtNode == USHRT_MAX )
+ {
+ // nothing to do --> empty change track text markup lists.
+ return;
+ }
+
+ const xub_StrLen nTxtFrmTextStartPos = rTxtFrm.IsFollow()
+ ? rTxtFrm.GetOfst()
+ : 0;
+ const xub_StrLen nTxtFrmTextEndPos = rTxtFrm.HasFollow()
+ ? rTxtFrm.GetFollow()->GetOfst()
+ : rTxtFrm.GetTxt().Len();
+
+ // iteration over the redlines which overlap with the text node.
+ const SwRedlineTbl& rRedlineTbl = pIDocChangeTrack->GetRedlineTbl();
+ const USHORT nRedlineCount( rRedlineTbl.Count() );
+ for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTxtNode;
+ nActRedline < nRedlineCount;
+ ++nActRedline)
+ {
+ const SwRedline* pActRedline = rRedlineTbl[ nActRedline ];
+ if ( pActRedline->Start()->nNode > rTxtNode.GetIndex() )
+ {
+ break;
+ }
+
+ xub_StrLen nTxtNodeChangeTrackStart( STRING_LEN );
+ xub_StrLen nTxtNodeChangeTrackEnd( STRING_LEN );
+ pActRedline->CalcStartEnd( rTxtNode.GetIndex(),
+ nTxtNodeChangeTrackStart,
+ nTxtNodeChangeTrackEnd );
+ if ( nTxtNodeChangeTrackStart > nTxtFrmTextEndPos ||
+ nTxtNodeChangeTrackEnd < nTxtFrmTextStartPos )
+ {
+ // Consider only redlines which overlap with the text frame's text.
+ continue;
+ }
+
+ SwWrongList* pMarkupList( 0 );
+ switch ( pActRedline->GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ {
+ pMarkupList = opChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ {
+ pMarkupList = opChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ {
+ pMarkupList = opChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ // other types are not considered
+ }
+ }
+ if ( pMarkupList )
+ {
+ const xub_StrLen nTxtFrmChangeTrackStart =
+ nTxtNodeChangeTrackStart <= nTxtFrmTextStartPos
+ ? nTxtFrmTextStartPos
+ : nTxtNodeChangeTrackStart;
+
+ const xub_StrLen nTxtFrmChangeTrackEnd =
+ nTxtNodeChangeTrackEnd >= nTxtFrmTextEndPos
+ ? nTxtFrmTextEndPos
+ : nTxtNodeChangeTrackEnd;
+
+ pMarkupList->Insert( rtl::OUString(), 0,
+ nTxtFrmChangeTrackStart,
+ nTxtFrmChangeTrackEnd - nTxtFrmChangeTrackStart,
+ pMarkupList->Count() );
+ }
+ } // eof iteration over the redlines which overlap with the text node
+ }
+} // eof anonymous namespace
+
+SwParaChangeTrackingInfo::SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm )
+ : mrTxtFrm( rTxtFrm )
+ , mpChangeTrackInsertionTextMarkupList( 0 )
+ , mpChangeTrackDeletionTextMarkupList( 0 )
+ , mpChangeTrackFormatChangeTextMarkupList( 0 )
+{
+}
+
+
+SwParaChangeTrackingInfo::~SwParaChangeTrackingInfo()
+{
+ reset();
+}
+
+void SwParaChangeTrackingInfo::reset()
+{
+ delete mpChangeTrackInsertionTextMarkupList;
+ mpChangeTrackInsertionTextMarkupList = 0;
+
+ delete mpChangeTrackDeletionTextMarkupList;
+ mpChangeTrackDeletionTextMarkupList = 0;
+
+ delete mpChangeTrackFormatChangeTextMarkupList;
+ mpChangeTrackFormatChangeTextMarkupList = 0;
+}
+
+const SwWrongList* SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType )
+{
+ SwWrongList* pChangeTrackingTextMarkupList = 0;
+
+ if ( mpChangeTrackInsertionTextMarkupList == 0 )
+ {
+ ASSERT( mpChangeTrackDeletionTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackDeletionTextMarkupList> expected to be NULL." );
+ ASSERT( mpChangeTrackFormatChangeTextMarkupList == 0,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..) - <mpChangeTrackFormatChangeTextMarkupList> expected to be NULL." );
+ initChangeTrackTextMarkupLists( mrTxtFrm,
+ mpChangeTrackInsertionTextMarkupList,
+ mpChangeTrackDeletionTextMarkupList,
+ mpChangeTrackFormatChangeTextMarkupList );
+ }
+
+ switch ( nTextMarkupType )
+ {
+ case css::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackInsertionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackDeletionTextMarkupList;
+ }
+ break;
+ case css::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pChangeTrackingTextMarkupList = mpChangeTrackFormatChangeTextMarkupList;
+ }
+ break;
+ default:
+ {
+ ASSERT( false,
+ "<SwParaChangeTrackingInfo::getChangeTrackingTextMarkupList(..)> - misusage - unexpected text markup type for change tracking." );
+ }
+ }
+
+ return pChangeTrackingTextMarkupList;
+}
diff --git a/sw/source/core/access/parachangetrackinginfo.hxx b/sw/source/core/access/parachangetrackinginfo.hxx
new file mode 100644
index 000000000000..91131f37b757
--- /dev/null
+++ b/sw/source/core/access/parachangetrackinginfo.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PARACHANGETRACKINGINFO_HXX_
+#define _PARACHANGETRACKINGINFO_HXX_
+
+#include <sal/types.h>
+
+class SwTxtFrm;
+class SwWrongList;
+
+class SwParaChangeTrackingInfo
+{
+ public:
+ explicit SwParaChangeTrackingInfo( const SwTxtFrm& rTxtFrm );
+ ~SwParaChangeTrackingInfo();
+
+ void reset();
+
+ const SwWrongList* getChangeTrackingTextMarkupList( const sal_Int32 nTextMarkupType );
+
+ private:
+ SwParaChangeTrackingInfo( const SwParaChangeTrackingInfo& );
+ SwParaChangeTrackingInfo& operator=( const SwParaChangeTrackingInfo& );
+
+ const SwTxtFrm& mrTxtFrm;
+
+ SwWrongList* mpChangeTrackInsertionTextMarkupList;
+ SwWrongList* mpChangeTrackDeletionTextMarkupList;
+ SwWrongList* mpChangeTrackFormatChangeTextMarkupList;
+};
+#endif
+
diff --git a/sw/source/core/access/textmarkuphelper.cxx b/sw/source/core/access/textmarkuphelper.cxx
index 0d92791ab29f..408a22ebd8ba 100644
--- a/sw/source/core/access/textmarkuphelper.cxx
+++ b/sw/source/core/access/textmarkuphelper.cxx
@@ -34,7 +34,7 @@
#include <algorithm>
#include <comphelper/stlunosequence.hxx>
-#include "errhdl.hxx"
+#include <errhdl.hxx>
#include <com/sun/star/text/TextMarkupType.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
@@ -81,22 +81,39 @@ namespace {
}
}
-// implementation of calss <SwTextMarkupoHelper>
-SwTextMarkupHelper::SwTextMarkupHelper( const SwTxtNode& rTxtNode,
- const SwAccessiblePortionData& rPortionData )
- : mrTxtNode( rTxtNode ),
- mrPortionData( rPortionData )
+// implementation of class <SwTextMarkupoHelper>
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode )
+ : mrPortionData( rPortionData )
+ // --> OD 2010-02-19 #i108125#
+ , mpTxtNode( &rTxtNode )
+ , mpTextMarkupList( 0 )
+ // <--
{
}
-sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
+// --> OD 2010-02-19 #i108125#
+SwTextMarkupHelper::SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList )
+ : mrPortionData( rPortionData )
+ , mpTxtNode( 0 )
+ , mpTextMarkupList( &rTextMarkupList )
+{
+}
+// <--
+
+sal_Int32 SwTextMarkupHelper::getTextMarkupCount( const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
{
sal_Int32 nTextMarkupCount( 0 );
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
if ( pTextMarkupList )
{
nTextMarkupCount = pTextMarkupList->Count();
@@ -105,8 +122,8 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
return nTextMarkupCount;
}
::com::sun::star::accessibility::TextSegment
- SwTextMarkupHelper::getTextMarkup( sal_Int32 nTextMarkupIndex,
- sal_Int32 nTextMarkupType )
+ SwTextMarkupHelper::getTextMarkup( const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
@@ -121,8 +138,12 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
aTextMarkupSegment.SegmentStart = -1;
aTextMarkupSegment.SegmentEnd = -1;
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
if ( pTextMarkupList )
{
const SwWrongArea* pTextMarkup =
@@ -149,8 +170,8 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
}
::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
- SwTextMarkupHelper::getTextMarkupAtIndex( sal_Int32 nCharIndex,
- sal_Int32 nTextMarkupType )
+ SwTextMarkupHelper::getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException)
@@ -166,9 +187,13 @@ sal_Int32 SwTextMarkupHelper::getTextMarkupCount( sal_Int32 nTextMarkupType )
return uno::Sequence< ::com::sun::star::accessibility::TextSegment >();
}
- ::std::vector< ::com::sun::star::accessibility::TextSegment > aTmpTextMarkups;
+ // --> OD 2010-02-19 #i108125#
const SwWrongList* pTextMarkupList =
- getTextMarkupList( mrTxtNode, nTextMarkupType );
+ mpTextMarkupList
+ ? mpTextMarkupList
+ : getTextMarkupList( *mpTxtNode, nTextMarkupType );
+ // <--
+ ::std::vector< ::com::sun::star::accessibility::TextSegment > aTmpTextMarkups;
if ( pTextMarkupList )
{
const ::rtl::OUString rText = mrPortionData.GetAccessibleString();
diff --git a/sw/source/core/access/textmarkuphelper.hxx b/sw/source/core/access/textmarkuphelper.hxx
index 64fbfec394d7..9b2bb519a2a1 100644
--- a/sw/source/core/access/textmarkuphelper.hxx
+++ b/sw/source/core/access/textmarkuphelper.hxx
@@ -37,30 +37,37 @@ namespace com { namespace sun { namespace star { namespace accessibility {
struct TextSegment;
} } } }
-class SwTxtNode;
class SwAccessiblePortionData;
+class SwTxtNode;
+// --> OD 2010-02-19 #i108125#
+class SwWrongList;
+// <--
class SwTextMarkupHelper
{
public:
- SwTextMarkupHelper( const SwTxtNode& rTxtNode,
- const SwAccessiblePortionData& rPortionData );
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwTxtNode& rTxtNode );
+ // --> OD 2010-02-19 #i108125#
+ SwTextMarkupHelper( const SwAccessiblePortionData& rPortionData,
+ const SwWrongList& rTextMarkupList );
+ // <--
~SwTextMarkupHelper() {}
- sal_Int32 getTextMarkupCount( sal_Int32 nTextMarkupType )
+ sal_Int32 getTextMarkupCount( const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
::com::sun::star::accessibility::TextSegment getTextMarkup(
- sal_Int32 nTextMarkupIndex,
- sal_Int32 nTextMarkupType )
+ const sal_Int32 nTextMarkupIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< ::com::sun::star::accessibility::TextSegment >
- getTextMarkupAtIndex( sal_Int32 nCharIndex,
- sal_Int32 nTextMarkupType )
+ getTextMarkupAtIndex( const sal_Int32 nCharIndex,
+ const sal_Int32 nTextMarkupType )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
@@ -69,8 +76,12 @@ class SwTextMarkupHelper
SwTextMarkupHelper( const SwTextMarkupHelper& );
SwTextMarkupHelper& operator=( const SwTextMarkupHelper& );
- const SwTxtNode& mrTxtNode;
const SwAccessiblePortionData& mrPortionData;
+
+ // --> OD 2010-02-19 #i108125#
+ const SwTxtNode* mpTxtNode;
+ const SwWrongList* mpTextMarkupList;
+ // <--
};
#endif
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 92cd9f5833cf..2c1b6e2bbb65 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -84,7 +84,7 @@ void SwIndexReg::ChkArr()
-SwIndex::SwIndex( SwIndexReg* pArr, xub_StrLen nIdx )
+SwIndex::SwIndex(SwIndexReg *const pArr, xub_StrLen const nIdx)
: nIndex( nIdx ), pArray( pArr ), pNext( 0 ), pPrev( 0 )
{
if( !pArray )
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 9ea80b899a6d..249500b95f98 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -710,8 +710,9 @@ BOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext,
SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
ASSERT( pTNd, "Wo ist mein CntntNode?" );
- SwTxtFld* pTxtFld = (SwTxtFld*)pTNd->GetTxtAttr( rPos.nContent,
- RES_TXTATR_FIELD );
+ SwTxtFld * pTxtFld = static_cast<SwTxtFld *>(
+ pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(),
+ RES_TXTATR_FIELD));
BOOL bDelFld = 0 == pTxtFld;
if( bDelFld )
{
@@ -1242,13 +1243,27 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt,
{
pTxtAttr = 0;
if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
- pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
- RES_TXTATR_TOXMARK );
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ pTxtNd->GetTxtAttrsAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ if (marks.size())
+ { // hmm... can only return 1 here
+ pTxtAttr = *marks.begin();
+ }
+ }
if( !pTxtAttr &&
SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
- pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
- RES_TXTATR_REFMARK );
+ {
+ ::std::vector<SwTxtAttr *> const marks(
+ pTxtNd->GetTxtAttrsAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_REFMARK));
+ if (marks.size())
+ { // hmm... can only return 1 here
+ pTxtAttr = *marks.begin();
+ }
+ }
if( pTxtAttr )
{
@@ -1293,8 +1308,8 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt,
if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
&& !aTmpState.bFtnNoInfo )
{
- pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
- RES_TXTATR_INETFMT );
+ pTxtAttr = pTxtNd->GetTxtAttrAt(
+ aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
// nur INetAttrs mit URLs "erkennen"
if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
{
@@ -1629,8 +1644,11 @@ BOOL SwCrsrShell::SelectTxtAttr( USHORT nWhich, BOOL bExpand,
if( !pTxtAttr )
{
SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
- pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( rPos.nContent,
- nWhich, bExpand ) : 0;
+ pTxtAttr = (pTxtNd)
+ ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
+ static_cast<RES_TXTATR>(nWhich),
+ (bExpand) ? SwTxtNode::EXPAND : SwTxtNode::DEFAULT)
+ : 0;
}
if( pTxtAttr )
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index bb458ad49643..aeaeeeb300bc 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -48,7 +48,6 @@
#include <swundo.hxx>
#include <breakit.hxx>
-/*testarea*/
#include <docsh.hxx>
#include <PostItMgr.hxx>
#include <viewsh.hxx>
@@ -334,7 +333,7 @@ BYTE SwPaM::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes , utl::Te
xub_StrLen aStart = 0;
// do we need to finish a note?
- if (POSTITMGR->GetActivePostIt())
+ if (POSTITMGR->HasActiveSidebarWin())
{
if (bSearchInNotes)
{
@@ -354,7 +353,7 @@ BYTE SwPaM::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes , utl::Te
}
else
{
- POSTITMGR->SetActivePostIt(0);
+ POSTITMGR->SetActiveSidebarWin(0);
}
}
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index af7360d64b40..3edf3718eabe 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -62,11 +62,13 @@ BOOL SwCursor::GotoFtnTxt()
{
// springe aus dem Content zur Fussnote
BOOL bRet = FALSE;
- SwTxtAttr *pFtn;
SwTxtNode* pTxtNd = GetPoint()->nNode.GetNode().GetTxtNode();
- if( pTxtNd && 0 != (
- pFtn = pTxtNd->GetTxtAttr( GetPoint()->nContent, RES_TXTATR_FTN ) ))
+ SwTxtAttr *const pFtn( (pTxtNd)
+ ? pTxtNd->GetTxtAttrForCharAt(
+ GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN)
+ : 0);
+ if (pFtn)
{
SwCrsrSaveState aSaveState( *this );
GetPoint()->nNode = *((SwTxtFtn*)pFtn)->GetStartNode();
diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx
index e9cf58df2dc4..bf6343e77bc0 100644
--- a/sw/source/core/crsr/trvlreg.cxx
+++ b/sw/source/core/crsr/trvlreg.cxx
@@ -262,7 +262,7 @@ BOOL SwCursor::GotoRegion( const String& rName )
const SwNodeIndex* pIdx;
const SwSection* pSect;
if( 0 != ( pSect = pFmt->GetSection() ) &&
- pSect->GetName() == rName &&
+ pSect->GetSectionName() == rName &&
0 != ( pIdx = pFmt->GetCntnt().GetCntntIdx() ) &&
pIdx->GetNode().GetNodes().IsDocNodes() )
{
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index e675e900e0f8..3c85091c7d20 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -52,6 +52,7 @@
#include <dbgoutsw.hxx>
#include <SwRewriter.hxx>
#include <iostream>
+#include <cstdio>
using namespace std;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index da366da4b6fa..7f2b92979f57 100755
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2323,11 +2323,10 @@ BOOL SwDoc::RemoveInvisibleContent()
}
if( pSect->GetCondition().Len() )
{
- SwSection aSect( pSect->GetType(), pSect->GetName() );
- aSect = *pSect;
- aSect.SetCondition( aEmptyStr );
- aSect.SetHidden( FALSE );
- ChgSection( n, aSect );
+ SwSectionData aSectionData( *pSect );
+ aSectionData.SetCondition( aEmptyStr );
+ aSectionData.SetHidden( false );
+ UpdateSection( n, aSectionData );
}
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 1e058867ba32..0080694722ba 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1023,9 +1023,8 @@ SaveBookmark::SaveBookmark(
m_aShortName = pBookmark->GetShortName();
m_aCode = pBookmark->GetKeyCode();
- ::sfx2::Metadatable * const pMetadatable(
- const_cast< ::sfx2::Metadatable * >( // CreateUndo should be const?
- dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)));
+ ::sfx2::Metadatable const*const pMetadatable(
+ dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
if (pMetadatable)
{
m_pMetadataUndo = pMetadatable->CreateUndo();
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 6451aebd4251..a19ece4daf66 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1412,7 +1412,7 @@ void SwCompareData::ShowDelete( const CompareData& rData, ULONG nStt,
if( *pCorr->GetPoint() == *pTmp->GetPoint() )
{
SwNodeIndex aTmpPos( pTmp->GetMark()->nNode, -1 );
- *pCorr->GetPoint() = SwPosition( aTmpPos, 0 );
+ *pCorr->GetPoint() = SwPosition( aTmpPos );
}
}
}
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index 5bf14845cbf3..d21e6313a2df 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -99,7 +99,9 @@ BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseS
SwSection* pSect = rpSectFmt->GetSection();
if( pSect )
{
- String sNm( bCaseSensitive ? pSect->GetName() : GetAppCharClass().lower( pSect->GetName() ));
+ String sNm( (bCaseSensitive)
+ ? pSect->GetSectionName()
+ : GetAppCharClass().lower( pSect->GetSectionName() ));
String sCompare( (bCaseSensitive)
? pItem->m_Item
: GetAppCharClass().lower( pItem->m_Item ) );
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index af1236b6371c..d971ac0c51fe 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -397,10 +397,9 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
// JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
// dann wird dessen Bereich genommen
- const SwTxtAttr* pURLAttr;
- if( pTxtNd->HasHints() &&
- 0 != ( pURLAttr = pTxtNd->GetTxtAttr( rSt, RES_TXTATR_INETFMT ))
- && pURLAttr->GetINetFmt().GetValue().Len() )
+ SwTxtAttr const*const pURLAttr(
+ pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
+ if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len())
{
nMkPos = *pURLAttr->GetStart();
nPtPos = *pURLAttr->GetEnd();
@@ -902,10 +901,9 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
// JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
// dann wird dessen Bereich genommen
- const SwTxtAttr* pURLAttr;
- if( pTxtNd->HasHints() &&
- 0 != ( pURLAttr = pTxtNd->GetTxtAttr( rSt, RES_TXTATR_INETFMT ))
- && pURLAttr->GetINetFmt().GetValue().Len() )
+ SwTxtAttr const*const pURLAttr(
+ pTxtNd->GetTxtAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
+ if (pURLAttr && pURLAttr->GetINetFmt().GetValue().Len())
{
nMkPos = *pURLAttr->GetStart();
nPtPos = *pURLAttr->GetEnd();
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index abf2e5b2217b..30a385442fc0 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -400,11 +400,11 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath,
default:
{
String sNm( INetURLObject( sFileName ).GetName() );
- SwSection aSect( FILE_LINK_SECTION,
+ SwSectionData aSectData( FILE_LINK_SECTION,
GetUniqueSectionName( &sNm ));
SwSectionFmt* pFmt = MakeSectionFmt( 0 );
- aSect.SetLinkFileName(sFileName );
- aSect.SetProtect();
+ aSectData.SetLinkFileName(sFileName);
+ aSectData.SetProtectFlag(true);
aEndIdx--; // im InsertSection ist Ende inclusive
while( aEndIdx.GetNode().IsStartNode() )
@@ -456,11 +456,15 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath,
SwNodeIndex aStartIdx(*pSttNd);
if (aEndIdx >= aStartIdx)
- pSectNd = GetNodes().InsertSection
- (aStartIdx, *pFmt, aSect, &aEndIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSectData, 0, &aEndIdx, false);
+ }
else
- pSectNd = GetNodes().InsertSection
- (aEndIdx, *pFmt, aSect, &aStartIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSectData, 0, &aStartIdx, false);
+ }
// <- #i26762#
pSectNd->GetSection().CreateLink( CREATE_CONNECT );
@@ -747,11 +751,11 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel )
default:
{
String sNm( INetURLObject( sFileName ).GetName() );
- SwSection aSect( FILE_LINK_SECTION,
+ SwSectionData aSectData( FILE_LINK_SECTION,
GetUniqueSectionName( &sNm ));
SwSectionFmt* pFmt = MakeSectionFmt( 0 );
- aSect.SetLinkFileName(sFileName );
- aSect.SetProtect();
+ aSectData.SetLinkFileName(sFileName);
+ aSectData.SetProtectFlag(true);
aEndIdx--; // im InsertSection ist Ende inclusive
while( aEndIdx.GetNode().IsStartNode() )
@@ -799,11 +803,15 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel )
SwNodeIndex aStartIdx(*pSttNd);
if (aEndIdx >= aStartIdx)
- pSectNd = GetNodes().InsertSection
- (aStartIdx, *pFmt, aSect, &aEndIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aStartIdx,
+ *pFmt, aSectData, 0, &aEndIdx, false);
+ }
else
- pSectNd = GetNodes().InsertSection
- (aEndIdx, *pFmt, aSect, &aStartIdx, FALSE );
+ {
+ pSectNd = GetNodes().InsertTextSection(aEndIdx,
+ *pFmt, aSectData, 0, &aStartIdx, false);
+ }
pSectNd->GetSection().CreateLink( CREATE_CONNECT );
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6e04d49afb3e..ceb7d6e3463c 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -947,8 +947,6 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
// Anker noch nicht gesetzt ?
// DrawObjecte duerfen niemals in Kopf-/Fusszeilen landen.
const bool bIsAtCntnt = (FLY_AT_PAGE != eAnchorId);
-// FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId ||
-// FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId;
const SwNodeIndex* pChkIdx = 0;
if( !pAnchor )
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 8dfcbb215e3a..fe4044dd58ac 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1407,8 +1407,8 @@ void SwDoc::Paste( const SwDoc& rSource )
{
aIndexBefore++;
- SwPaM aPaM(SwPosition(aIndexBefore, 0),
- SwPosition(rInsPos.nNode, 0));
+ SwPaM aPaM(SwPosition(aIndexBefore),
+ SwPosition(rInsPos.nNode));
MakeUniqueNumRules(aPaM);
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 3b36416ecb64..58b3e084cf7a 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -366,26 +366,23 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
{
StartUndo( UNDO_INSTOX, NULL );
- SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
String sSectNm( rTOX.GetTOXName() );
sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm );
- pNew->SetTOXName(sSectNm);
- pNew->SwSection::SetName(sSectNm);
SwPaM aPam( rPos );
- SwSection* pSect = InsertSwSection( aPam, *pNew, pSet, false );
- if( pSect )
+ SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
+ SwTOXBaseSection *const pNewSection = dynamic_cast<SwTOXBaseSection *>(
+ InsertSwSection( aPam, aSectionData, & rTOX, pSet, false ));
+ if (pNewSection)
{
- SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode();
- SwSection* pCl = pNew;
- pSect->GetFmt()->Add( pCl );
- pSectNd->SetNewSection( pNew );
+ SwSectionNode *const pSectNd = pNewSection->GetFmt()->GetSectionNode();
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
if( bExpand )
{
// OD 19.03.2003 #106329# - add value for 2nd parameter = true to
// indicate, that a creation of a new table of content has to be performed.
// Value of 1st parameter = default value.
- pNew->Update( 0, true );
+ pNewSection->Update( 0, true );
}
else if( 1 == rTOX.GetTitle().Len() && IsInReading() )
// insert title of TOX
@@ -396,24 +393,22 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx,
GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
- String sNm( pNew->GetTOXName() );
+ String sNm( pNewSection->GetTOXName() );
// ??Resource
sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
- SwSection aSect( TOX_HEADER_SECTION, sNm );
+ SwSectionData headerData( TOX_HEADER_SECTION, sNm );
SwNodeIndex aStt( *pHeadNd ); aIdx--;
SwSectionFmt* pSectFmt = MakeSectionFmt( 0 );
- GetNodes().InsertSection( aStt, *pSectFmt, aSect, &aIdx,
- TRUE, FALSE );
+ GetNodes().InsertTextSection(
+ aStt, *pSectFmt, headerData, 0, &aIdx, true, false);
}
}
- else
- delete pNew, pNew = 0;
EndUndo( UNDO_INSTOX, NULL );
- return pNew;
+ return pNewSection;
}
@@ -433,13 +428,10 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd,
pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
}
- // create SectionNode around the Nodes
- SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
-
String sSectNm( rTOX.GetTOXName() );
sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), &sSectNm);
- pNew->SetTOXName(sSectNm);
- pNew->SwSection::SetName(sSectNm);
+
+ SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
SwSectionFmt* pFmt = MakeSectionFmt( 0 );
@@ -448,20 +440,18 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd,
// --aEnd; // im InsertSection ist Ende inclusive
- pSectNd = GetNodes().InsertSection( aStt, *pFmt, *pNew, &aEnd );
- if( pSectNd )
+ SwSectionNode *const pNewSectionNode =
+ GetNodes().InsertTextSection(aStt, *pFmt, aSectionData, &rTOX, &aEnd);
+ if (!pNewSectionNode)
{
- SwSection* pCl = pNew;
- pFmt->Add( pCl );
- pSectNd->SetNewSection( pNew );
- }
- else
- {
- delete pNew, pNew = 0;
DelSectionFmt( pFmt );
+ return 0;
}
- return pNew;
+ SwTOXBaseSection *const pNewSection(
+ dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
+ return pNewSection;
}
/*--------------------------------------------------------------------
@@ -578,7 +568,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes )
aSearchPam will contain the point where to move the cursors
to. */
SwPaM aSearchPam(*pMyNode->EndOfSectionNode());
- SwPosition aEndPos(*pStartNd->EndOfSectionNode(), 0);
+ SwPosition aEndPos(*pStartNd->EndOfSectionNode());
if (! aSearchPam.Move() /* no content node found */
|| *aSearchPam.GetPoint() >= aEndPos /* content node found
outside surrounding */
@@ -588,7 +578,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes )
content node */
SwPaM aTmpPam(*pMyNode);
aSearchPam = aTmpPam;
- SwPosition aStartPos(*pStartNd, 0);
+ SwPosition aStartPos(*pStartNd);
if ( ! aSearchPam.Move(fnMoveBackward) /* no content node found */
|| *aSearchPam.GetPoint() <= aStartPos /* content node
@@ -599,7 +589,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes )
/* There is no content node in the surrounding of
TOX'. Append text node behind TOX' section. */
- SwPosition aInsPos(*pMyNode->EndOfSectionNode(), 0);
+ SwPosition aInsPos(*pMyNode->EndOfSectionNode());
AppendTxtNode(aInsPos);
SwPaM aTmpPam1(aInsPos);
@@ -697,7 +687,7 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) )&&
TOX_CONTENT_SECTION == (pSect = &pSectNd->GetSection())->GetType())
{
- const String& rNm = pSect->GetName();
+ const String& rNm = pSect->GetSectionName();
if( rNm.Match( aName ) == nNmLen )
{
// Nummer bestimmen und das Flag setzen
@@ -743,7 +733,7 @@ BOOL SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName)
if(bRet)
{
pTOX->SetTOXName(rName);
- pTOX->SwTOXBaseSection::SetName(rName);
+ pTOX->SetSectionName(rName);
SetModified();
}
return bRet;
@@ -776,11 +766,12 @@ const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, BYTE nLvl = 0 )
Beschreibung: Verzeichnis-Klasse
--------------------------------------------------------------------*/
-SwTOXBaseSection::SwTOXBaseSection( const SwTOXBase& rBase )
- : SwTOXBase( rBase ), SwSection( TOX_CONTENT_SECTION, aEmptyStr )
+SwTOXBaseSection::SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt)
+ : SwTOXBase( rBase )
+ , SwSection( TOX_CONTENT_SECTION, aEmptyStr, rFmt )
{
SetProtect( rBase.IsProtected() );
- SwSection::SetName( GetTOXName() );
+ SetSectionName( GetTOXName() );
}
@@ -962,12 +953,12 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
// ??Resource
sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
- SwSection aSect( TOX_HEADER_SECTION, sNm );
+ SwSectionData headerData( TOX_HEADER_SECTION, sNm );
SwNodeIndex aStt( *pHeadNd ); aIdx--;
SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
- pDoc->GetNodes().InsertSection( aStt, *pSectFmt, aSect, &aIdx,
- TRUE, FALSE );
+ pDoc->GetNodes().InsertTextSection(
+ aStt, *pSectFmt, headerData, 0, &aIdx, true, false);
}
// jetzt waere ein prima Zeitpunkt, um die Numerierung zu updaten
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index acb0d6acd274..306560272c6f 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -137,7 +137,7 @@ bool lcl_IsInSameTblBox( SwNodes& _rNds,
return true;
}
-void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSection& rSect,
+void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSectionData& rSectionData,
const SwNode& rStt, const SwNode& rEnd )
{
SwNodeIndex aIdx( rStt );
@@ -151,12 +151,16 @@ void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSection& rSect,
!CheckNodesRange( rEnd, aIdx, TRUE ) ||
// OD 04.11.2003 #i21457#
!lcl_IsInSameTblBox( rNds, rEnd, false ))
- rSect.SetHidden( FALSE );
+ {
+ rSectionData.SetHidden( false );
+ }
}
}
-SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
- const SfxItemSet* pAttr, bool bUpdate )
+SwSection *
+SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
+ SwTOXBase const*const pTOXBase,
+ SfxItemSet const*const pAttr, bool const bUpdate)
{
const SwNode* pPrvNd = 0;
USHORT nRegionRet = 0;
@@ -169,14 +173,15 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
// Teste ob das gesamte Dokument versteckt werden soll,
// koennen wir zur Zeit nicht !!!!
- if( rNew.IsHidden() && rRange.HasMark() )
+ if (rNewData.IsHidden() && rRange.HasMark())
{
const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
if( !pStt->nContent.GetIndex() &&
pEnd->nNode.GetNode().GetCntntNode()->Len() ==
pEnd->nContent.GetIndex() )
{
- ::lcl_CheckEmptyLayFrm( GetNodes(), const_cast<SwSection&>(rNew),
+ ::lcl_CheckEmptyLayFrm( GetNodes(),
+ rNewData,
pStt->nNode.GetNode(),
pEnd->nNode.GetNode() );
}
@@ -186,7 +191,7 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
if( DoesUndo() )
{
ClearRedo();
- pUndoInsSect = new SwUndoInsSection( rRange, rNew, pAttr );
+ pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase);
AppendUndo( pUndoInsSect );
DoUndo( FALSE );
}
@@ -216,7 +221,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
aEnd++;
--aEnd; // im InsertSection ist Ende inclusive
- pNewSectNode = GetNodes().InsertSection( aStt, *pFmt, rNew, &aEnd );
+ pNewSectNode = GetNodes().InsertTextSection(
+ aStt, *pFmt, rNewData, pTOXBase, & aEnd);
}
else
{
@@ -287,8 +293,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
pEndPos->nContent.Assign( pTNd, nCntnt );
}
}
- pNewSectNode = GetNodes().InsertSection( pSttPos->nNode, *pFmt, rNew,
- &pEndPos->nNode );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pSttPos->nNode, *pFmt, rNewData, pTOXBase, &pEndPos->nNode);
}
}
else
@@ -297,11 +303,13 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
const SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
if( !pPos->nContent.GetIndex() )
{
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
}
else if( pPos->nContent.GetIndex() == pCNd->Len() )
{
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, FALSE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, false);
}
else
{
@@ -310,7 +318,8 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
pUndoInsSect->SaveSplitNode( (SwTxtNode*)pCNd, TRUE );
}
SplitNode( *pPos, false );
- pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+ pNewSectNode = GetNodes().InsertTextSection(
+ pPos->nNode, *pFmt, rNewData, pTOXBase, 0, true);
}
}
@@ -334,7 +343,7 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
}
// ist eine Condition gesetzt
- if( rNew.IsHidden() && rNew.GetCondition().Len() )
+ if (rNewData.IsHidden() && rNewData.GetCondition().Len())
{
// dann berechne bis zu dieser Position
SwCalc aCalc( *this );
@@ -368,7 +377,7 @@ SwSection* SwDoc::InsertSwSection( const SwPaM& rRange, const SwSection& rNew,
DoUndo( TRUE );
}
- if( rNew.IsLinkType() )
+ if (rNewData.IsLinkType())
{
pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
}
@@ -549,7 +558,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes )
EndUndo(UNDO_DELSECTION, NULL);
return ;
}
- AppendUndo( new SwUndoDelSection( *pFmt ) );
+ AppendUndo( MakeUndoDelSection( *pFmt ) );
}
else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
@@ -609,9 +618,8 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes )
SetModified();
}
-void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
- const SfxItemSet* pAttr,
- sal_Bool bPreventLinkUpdate )
+void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
+ SfxItemSet const*const pAttr, bool const bPreventLinkUpdate)
{
SwSectionFmt* pFmt = (*pSectionFmtTbl)[ nPos ];
SwSection* pSection = pFmt->GetSection();
@@ -619,7 +627,7 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
/// remember hidden condition flag of SwSection before changes
bool bOldCondHidden = pSection->IsCondHidden() ? true : false;
- if( *pSection == rSect )
+ if (pSection->DataEquals(rNewData))
{
// die Attribute ueberpruefen
BOOL bOnlyAttrChg = FALSE;
@@ -647,7 +655,7 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
if( DoesUndo() )
{
ClearRedo();
- AppendUndo( new SwUndoChgSection( *pFmt, TRUE ) );
+ AppendUndo( MakeUndoUpdateSection( *pFmt, true ) );
// --> FME 2004-10-13 #i32968#
// Inserting columns in the section causes MakeFrmFmt to put two
// objects of type SwUndoFrmFmt on the undo stack. We don't want them.
@@ -668,12 +676,19 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
// versteckt werden soll, koennen wir zur Zeit nicht !!!!
const SwNodeIndex* pIdx = 0;
{
- const SwSectionNode* pSectNd;
- if( rSect.IsHidden() && 0 != (pIdx = pFmt->GetCntnt().GetCntntIdx() )
- && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ) )
+ if (rNewData.IsHidden())
{
- ::lcl_CheckEmptyLayFrm( GetNodes(), (SwSection&)rSect,
+ pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if (pIdx)
+ {
+ const SwSectionNode* pSectNd =
+ pIdx->GetNode().GetSectionNode();
+ if (pSectNd)
+ {
+ ::lcl_CheckEmptyLayFrm( GetNodes(), rNewData,
*pSectNd, *pSectNd->EndOfSectionNode() );
+ }
+ }
}
}
@@ -681,7 +696,7 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
if( DoesUndo() )
{
ClearRedo();
- AppendUndo( new SwUndoChgSection( *pFmt, FALSE ) );
+ AppendUndo( MakeUndoUpdateSection( *pFmt, false ) );
// --> FME 2004-10-13 #i32968#
// Inserting columns in the section causes MakeFrmFmt to put two
// objects of type SwUndoFrmFmt on the undo stack. We don't want them.
@@ -692,14 +707,14 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
// #56167# Der LinkFileName koennte auch nur aus Separatoren bestehen
String sCompareString = sfx2::cTokenSeperator;
sCompareString += sfx2::cTokenSeperator;
- BOOL bUpdate = ( !pSection->IsLinkType() && rSect.IsLinkType() ) ||
- ( rSect.GetLinkFileName().Len() &&
- rSect.GetLinkFileName() != sCompareString &&
- rSect.GetLinkFileName() !=
- pSection->GetLinkFileName());
-
- String sSectName( rSect.GetName() );
- if( sSectName != pSection->GetName() )
+ const bool bUpdate =
+ (!pSection->IsLinkType() && rNewData.IsLinkType())
+ || ( rNewData.GetLinkFileName().Len()
+ && (rNewData.GetLinkFileName() != sCompareString)
+ && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
+
+ String sSectName( rNewData.GetSectionName() );
+ if (sSectName != pSection->GetSectionName())
GetUniqueSectionName( &sSectName );
else
sSectName.Erase();
@@ -711,13 +726,15 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
/// or it is set to the value of SwSection which is assigned to it.
/// Discussion with AMA results that the adjustment to the assignment operator
/// could be very risky -> see notes in bug #102894#.
- *pSection = rSect;
+ pSection->SetSectionData(rNewData);
if( pAttr )
pSection->GetFmt()->SetFmtAttr( *pAttr );
if( sSectName.Len() )
- pSection->SetName( sSectName );
+ {
+ pSection->SetSectionName( sSectName );
+ }
// ist eine Condition gesetzt
if( pSection->IsHidden() && pSection->GetCondition().Len() )
@@ -729,7 +746,7 @@ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
FldsToCalc( aCalc, pIdx->GetIndex(), USHRT_MAX );
/// OD 04.10.2002 #102894#
/// Because on using SwSection::operator=() to set up <pSection>
- /// with <rSect> and the above given note, the hidden condition flag
+ /// with <rNewData> and the above given note, the hidden condition flag
/// has to be set to FALSE, if hidden condition flag of <pFmt->GetSection()>
/// (SwSection before the changes) is FALSE (already saved in <bOldCondHidden>)
/// and new calculated condition is TRUE.
@@ -800,17 +817,18 @@ void lcl_DeleteFtn( SwSectionNode *pNd, ULONG nStt, ULONG nEnd )
}
}
-inline BOOL lcl_IsTOXSection( const SwSection& rSection )
+static inline bool lcl_IsTOXSection(SwSectionData const& rSectionData)
{
- return TOX_CONTENT_SECTION == rSection.GetType() ||
- TOX_HEADER_SECTION == rSection.GetType();
+ return (TOX_CONTENT_SECTION == rSectionData.GetType())
+ || (TOX_HEADER_SECTION == rSectionData.GetType());
}
-SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
+SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
SwSectionFmt& rSectionFmt,
- const SwSection& rSection,
- const SwNodeIndex* pEnde,
- BOOL bInsAtStart, BOOL bCreateFrms )
+ SwSectionData const& rSectionData,
+ SwTOXBase const*const pTOXBase,
+ SwNodeIndex const*const pEnde,
+ bool const bInsAtStart, bool const bCreateFrms)
{
SwNodeIndex aInsPos( rNdIdx );
if( !pEnde ) // kein Bereich also neue Section davor/hinter anlegen
@@ -821,7 +839,7 @@ SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
if( bInsAtStart )
{
- if( !lcl_IsTOXSection( rSection ))
+ if (!lcl_IsTOXSection(rSectionData))
{
do {
aInsPos--;
@@ -833,15 +851,20 @@ SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
{
SwNode* pNd;
aInsPos++;
- if( !lcl_IsTOXSection( rSection ))
+ if (!lcl_IsTOXSection(rSectionData))
+ {
while( aInsPos.GetIndex() < Count() - 1 &&
( pNd = &aInsPos.GetNode())->IsEndNode() &&
pNd->StartOfSectionNode()->IsSectionNode())
+ {
aInsPos++;
+ }
+ }
}
}
- SwSectionNode* pSectNd = new SwSectionNode( aInsPos, rSectionFmt );
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(aInsPos, rSectionFmt, pTOXBase);
if( pEnde )
{
// Sonderfall fuer die Reader/Writer
@@ -908,7 +931,7 @@ SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
}
new SwEndNode( aInsPos, *pSectNd );
- pSectNd->GetSection() = rSection;
+ pSectNd->GetSection().SetSectionData(rSectionData);
SwSectionFmt* pSectFmt = pSectNd->GetSection().GetFmt();
// Hier bietet sich als Optimierung an, vorhandene Frames nicht zu
@@ -998,17 +1021,28 @@ SwSectionNode* SwNode::FindSectionNode()
// SwSectionNode
//---------
-SwSectionNode::SwSectionNode( const SwNodeIndex& rIdx, SwSectionFmt& rFmt )
- : SwStartNode( rIdx, ND_SECTIONNODE )
+// ugly hack to make m_pSection const
+static SwSectionFmt &
+lcl_initParent(SwSectionNode & rThis, SwSectionFmt & rFmt)
{
- SwSectionNode* pParent = StartOfSectionNode()->FindSectionNode();
+ SwSectionNode *const pParent =
+ rThis.StartOfSectionNode()->FindSectionNode();
if( pParent )
{
// das Format beim richtigen Parent anmelden.
rFmt.SetDerivedFrom( pParent->GetSection().GetFmt() );
}
- pSection = new SwSection( CONTENT_SECTION, rFmt.GetName(), &rFmt );
+ return rFmt;
+}
+SwSectionNode::SwSectionNode(SwNodeIndex const& rIdx,
+ SwSectionFmt & rFmt, SwTOXBase const*const pTOXBase)
+ : SwStartNode( rIdx, ND_SECTIONNODE )
+ , m_pSection( (pTOXBase)
+ ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFmt))
+ : new SwSection( CONTENT_SECTION, rFmt.GetName(),
+ lcl_initParent(*this, rFmt) ) )
+{
// jetzt noch die Verbindung von Format zum Node setzen
// Modify unterdruecken, interresiert keinen
rFmt.LockModify();
@@ -1049,7 +1083,7 @@ SwFrm* SwClearDummies( SwFrm* pFrm )
SwSectionNode::~SwSectionNode()
{
{
- SwClientIter aIter( *(pSection->GetFmt()) );
+ SwClientIter aIter( *(m_pSection->GetFmt()) );
SwClient *pLast = aIter.GoStart();
while ( pLast )
{
@@ -1065,7 +1099,7 @@ SwSectionNode::~SwSectionNode()
}
SwDoc* pDoc = GetDoc();
- SwSectionFmt* pFmt = pSection->GetFmt();
+ SwSectionFmt* pFmt = m_pSection->GetFmt();
if( pFmt )
{
// das Attribut entfernen, weil die Section ihr Format loescht
@@ -1079,41 +1113,14 @@ SwSectionNode::~SwSectionNode()
// verhinder beim Loeschen aus der Undo/Redo-History einen rekursiven Aufruf
if( bUndo && &pDoc->GetNodes() != &GetNodes() )
pDoc->DoUndo( FALSE );
- DELETEZ( pSection );
pDoc->DoUndo( bUndo );
}
-// setze ein neues SectionObject. Erstmal nur gedacht fuer die
-// neuen VerzeichnisSections. Der geht ueber in den Besitz des Nodes!
-void SwSectionNode::SetNewSection( SwSection* pNewSection )
-{
- ASSERT( pNewSection, "ohne Pointer geht hier nichts" );
- if( pNewSection )
- {
- SwNode2Layout aN2L( *this );
-
- // einige Flags sollten ueber nommen werden!
- pNewSection->bProtectFlag = pSection->bProtectFlag;
- pNewSection->bHiddenFlag = pSection->bHiddenFlag;
- pNewSection->bHidden = pSection->bHidden;
- pNewSection->bCondHiddenFlag = pSection->bCondHiddenFlag;
-
- // The section frame contains a pointer to the section. That for,
- // the frame must be destroyed before deleting the section.
- DelFrms();
-
- delete pSection;
- pSection = pNewSection;
-
- ULONG nIdx = GetIndex();
- aN2L.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
- }
-}
SwFrm *SwSectionNode::MakeFrm()
{
- pSection->bHiddenFlag = FALSE;
- return new SwSectionFrm( *pSection );
+ m_pSection->m_Data.SetHiddenFlag(false);
+ return new SwSectionFrm( *m_pSection );
}
//Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
@@ -1240,7 +1247,7 @@ void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx )
*pIdxBehind = *this;
- pSection->bHiddenFlag = TRUE;
+ m_pSection->m_Data.SetHiddenFlag(true);
if( rNds.IsDocNodes() )
{
@@ -1264,10 +1271,10 @@ void SwSectionNode::DelFrms()
}
SwNodes& rNds = GetNodes();
- pSection->GetFmt()->DelFrms();
+ m_pSection->GetFmt()->DelFrms();
// unser Flag muessen wir noch aktualisieren
- pSection->bHiddenFlag = TRUE;
+ m_pSection->m_Data.SetHiddenFlag(true);
// Bug 30582: falls der Bereich in Fly oder TabellenBox ist, dann
// kann er nur "gehiddet" werden, wenn weiterer Content
@@ -1285,7 +1292,9 @@ void SwSectionNode::DelFrms()
!CheckNodesRange( *EndOfSectionNode(), aIdx, TRUE ) ||
// OD 04.11.2003 #i21457#
!lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), false ))
- pSection->bHiddenFlag = FALSE;
+ {
+ m_pSection->m_Data.SetHiddenFlag(false);
+ }
}
}
}
@@ -1299,37 +1308,35 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
pSectFmt->CopyAttrs( *GetSection().GetFmt() );
- SwSectionNode* pSectNd = new SwSectionNode( rIdx, *pSectFmt );
+ ::std::auto_ptr<SwTOXBase> pTOXBase;
+ if (TOX_CONTENT_SECTION == GetSection().GetType())
+ {
+ ASSERT( GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+ SwTOXBaseSection const& rTBS(
+ dynamic_cast<SwTOXBaseSection const&>(GetSection()));
+ pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
+ }
+
+ SwSectionNode *const pSectNd =
+ new SwSectionNode(rIdx, *pSectFmt, pTOXBase.get());
SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
SwNodeIndex aInsPos( *pEndNd );
// Werte uebertragen
- SwSection* pNewSect = pSectNd->pSection;
+ SwSection *const pNewSect = pSectNd->m_pSection.get();
- switch( GetSection().GetType() )
+ if (TOX_CONTENT_SECTION != GetSection().GetType())
{
- case TOX_CONTENT_SECTION:
- {
- ASSERT( GetSection().ISA( SwTOXBaseSection ), "keine TOXBaseSection!" );
- SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&)GetSection();
- SwTOXBase aTmp( rTOXSect, pDoc );
-
- SwTOXBaseSection* pNew = new SwTOXBaseSection( aTmp );
-
- pNewSect = pNew;
- pSectFmt->Add( pNewSect );
- pSectNd->SetNewSection( pNew );
- }
- break;
-
- default:
// beim Move den Namen beibehalten
if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
- pNewSect->SetName( GetSection().GetName() );
+ {
+ pNewSect->SetSectionName( GetSection().GetSectionName() );
+ }
else
- pNewSect->SetName( pDoc->GetUniqueSectionName(
- &GetSection().GetName() ) );
- break;
+ {
+ pNewSect->SetSectionName(
+ pDoc->GetUniqueSectionName( &GetSection().GetSectionName() ));
+ }
}
@@ -1358,18 +1365,22 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
: CREATE_NONE );
// falls als Server aus dem Undo kopiert wird, wieder eintragen
- if( pSection->IsServer() && pDoc->GetUndoNds() == &rNds )
+ if (m_pSection->IsServer() && (pDoc->GetUndoNds() == &rNds))
{
- pNewSect->SetRefObject( pSection->GetObject() );
+ pNewSect->SetRefObject( m_pSection->GetObject() );
pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() );
}
+ // METADATA: copy xml:id; must be done after insertion of node
+ pSectFmt->RegisterAsCopyOf(*GetSection().GetFmt());
+
return pSectNd;
}
BOOL SwSectionNode::IsCntntHidden() const
{
- ASSERT( !pSection->IsHidden(), "That's simple: Hidden Section => Hidden Content" );
+ ASSERT( !m_pSection->IsHidden(),
+ "That's simple: Hidden Section => Hidden Content" );
SwNodeIndex aTmp( *this, 1 );
ULONG nEnd = EndOfSectionIndex();
while( aTmp < nEnd )
@@ -1395,7 +1406,7 @@ BOOL SwSectionNode::IsCntntHidden() const
void SwSectionNode::NodesArrChgd()
{
- SwSectionFmt* pFmt = pSection->GetFmt();
+ SwSectionFmt *const pFmt = m_pSection->GetFmt();
if( pFmt )
{
SwNodes& rNds = GetNodes();
@@ -1431,20 +1442,28 @@ void SwSectionNode::NodesArrChgd()
{
ASSERT( pDoc == GetDoc(),
"verschieben in unterschiedliche Documente?" );
- if( pSection->IsLinkType() ) // den Link austragen
- pSection->CreateLink( pDoc->GetRootFrm() ? CREATE_CONNECT
+ if (m_pSection->IsLinkType())
+ {
+ m_pSection->CreateLink( pDoc->GetRootFrm() ? CREATE_CONNECT
: CREATE_NONE );
+ }
- if( pSection->IsServer() ) // als Server austragen
- pDoc->GetLinkManager().InsertServer( pSection->GetObject() );
+ if (m_pSection->IsServer())
+ {
+ pDoc->GetLinkManager().InsertServer( m_pSection->GetObject() );
+ }
}
else
{
- if( CONTENT_SECTION != pSection->GetType() ) // den Link austragen
- pDoc->GetLinkManager().Remove( &pSection->GetBaseLink() );
+ if (CONTENT_SECTION != m_pSection->GetType())
+ {
+ pDoc->GetLinkManager().Remove( &m_pSection->GetBaseLink() );
+ }
- if( pSection->IsServer() ) // als Server austragen
- pDoc->GetLinkManager().RemoveServer( pSection->GetObject() );
+ if (m_pSection->IsServer())
+ {
+ pDoc->GetLinkManager().RemoveServer( m_pSection->GetObject() );
+ }
}
}
}
@@ -1467,7 +1486,7 @@ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
for( n = 0; n < pSectionFmtTbl->Count(); ++n )
if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) ))
{
- const String& rNm = pSectNd->GetSection().GetName();
+ const String& rNm = pSectNd->GetSection().GetSectionName();
if( rNm.Match( aName ) == nNmLen )
{
// Nummer bestimmen und das Flag setzen
diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx
index b0d6a4a931b5..cce0919e1e1a 100644
--- a/sw/source/core/docnode/node2lay.cxx
+++ b/sw/source/core/docnode/node2lay.cxx
@@ -233,8 +233,8 @@ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
{
// #137684#: pFrm could be a "dummy"-section
if( ((SwSectionFrm*)pFrm)->GetSection() &&
- ((SwSectionNode*)pNode)->GetSection() ==
- *((SwSectionFrm*)pFrm)->GetSection() )
+ (&((SwSectionNode*)pNode)->GetSection() ==
+ ((SwSectionFrm*)pFrm)->GetSection()) )
{
// OD 2004-06-02 #i22922# - consider columned sections
// 'Go down' the section frame as long as the layout frame
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 653ce6794e7e..2d54cb88f2e6 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -51,9 +51,7 @@
#include <frmtool.hxx>
#include <editsh.hxx>
#include <hints.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <ndtxt.hxx>
#include <section.hxx>
#include <swserv.hxx>
@@ -70,6 +68,7 @@
#include <fmteiro.hxx>
// <--
#include <swerror.h>
+#include <unosection.hxx>
using namespace ::com::sun::star;
@@ -115,39 +114,126 @@ SV_IMPL_PTRARR( SwSections, SwSection*)
SV_IMPL_PTRARR(SwSectionFmts,SwSectionFmt*)
+SwSectionData::SwSectionData(SectionType const eType, String const& rName)
+ : m_eType(eType)
+ , m_sSectionName(rName)
+ , m_bHiddenFlag(false)
+ , m_bProtectFlag(false)
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonlyFlag(false)
+ // <--
+ , m_bHidden(false)
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(true)
+{
+}
-SwSection::SwSection( SectionType eTyp, const String& rName,
- SwSectionFmt* pFmt )
- : SwClient( pFmt ), sSectionNm( rName ),
- eType( eTyp )
+// this must have the same semantics as operator=()
+SwSectionData::SwSectionData(SwSection const& rSection)
+ : m_eType(rSection.GetType())
+ , m_sSectionName(rSection.GetSectionName())
+ , m_sCondition(rSection.GetCondition())
+ , m_sLinkFileName(rSection.GetLinkFileName())
+ , m_sLinkFilePassword(rSection.GetLinkFilePassword())
+ , m_Password(rSection.GetPassword())
+ , m_bHiddenFlag(rSection.IsHiddenFlag())
+ , m_bProtectFlag(rSection.IsProtect())
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ , m_bEditInReadonlyFlag(rSection.IsEditInReadonly())
+ // <--
+ , m_bHidden(rSection.IsHidden())
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(rSection.IsConnectFlag())
{
- bHidden = FALSE;
- bHiddenFlag = FALSE;
- bProtectFlag = FALSE;
+}
+
+// this must have the same semantics as operator=()
+SwSectionData::SwSectionData(SwSectionData const& rOther)
+ : m_eType(rOther.m_eType)
+ , m_sSectionName(rOther.m_sSectionName)
+ , m_sCondition(rOther.m_sCondition)
+ , m_sLinkFileName(rOther.m_sLinkFileName)
+ , m_sLinkFilePassword(rOther.m_sLinkFilePassword)
+ , m_Password(rOther.m_Password)
+ , m_bHiddenFlag(rOther.m_bHiddenFlag)
+ , m_bProtectFlag(rOther.m_bProtectFlag)
// --> FME 2004-06-22 #114856# edit in readonly sections
- bEditInReadonlyFlag = FALSE;
+ , m_bEditInReadonlyFlag(rOther.m_bEditInReadonlyFlag)
// <--
- bCondHiddenFlag = TRUE;
- bConnectFlag = TRUE;
+ , m_bHidden(rOther.m_bHidden)
+ , m_bCondHiddenFlag(true)
+ , m_bConnectFlag(rOther.m_bConnectFlag)
+{
+}
+
+// the semantics here are weird for reasons of backward compatibility
+SwSectionData & SwSectionData::operator= (SwSectionData const& rOther)
+{
+ m_eType = rOther.m_eType;
+ m_sSectionName = rOther.m_sSectionName;
+ m_sCondition = rOther.m_sCondition;
+ m_sLinkFileName = rOther.m_sLinkFileName;
+ m_sLinkFilePassword = rOther.m_sLinkFilePassword;
+ m_bConnectFlag = rOther.m_bConnectFlag;
+ m_Password = rOther.m_Password;
+
+ m_bEditInReadonlyFlag = rOther.m_bEditInReadonlyFlag;
+ m_bProtectFlag = rOther.m_bProtectFlag;
+
+ m_bHidden = rOther.m_bHidden;
+ // FIXME: old code did not assign m_bHiddenFlag ?
+ // FIXME: why should m_bCondHiddenFlag always default to true?
+ m_bCondHiddenFlag = true;
- SwSectionPtr pParentSect = GetParent();
+ return *this;
+}
+
+// the semantics here are weird for reasons of backward compatibility
+bool SwSectionData::operator==(SwSectionData const& rOther) const
+{
+ return (m_eType == rOther.m_eType)
+ && (m_sSectionName == rOther.m_sSectionName)
+ && (m_sCondition == rOther.m_sCondition)
+ && (m_bHidden == rOther.m_bHidden)
+ && (m_bProtectFlag == rOther.m_bProtectFlag)
+ && (m_bEditInReadonlyFlag == rOther.m_bEditInReadonlyFlag)
+ && (m_sLinkFileName == rOther.m_sLinkFileName)
+ && (m_sLinkFilePassword == rOther.m_sLinkFilePassword)
+ && (m_Password == rOther.m_Password);
+ // FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
+}
+
+// SwSection ===========================================================
+
+SwSection::SwSection(
+ SectionType const eType, String const& rName, SwSectionFmt & rFormat)
+ : SwClient(& rFormat)
+ , m_Data(eType, rName)
+{
+ SwSection *const pParentSect = GetParent();
if( pParentSect )
{
if( pParentSect->IsHiddenFlag() )
- SetHidden( TRUE );
+ {
+ SetHidden( true );
+ }
- _SetProtectFlag( pParentSect->IsProtectFlag() );
+ m_Data.SetProtectFlag( pParentSect->IsProtectFlag() );
// --> FME 2004-06-22 #114856# edit in readonly sections
- _SetEditInReadonlyFlag( pParentSect->IsEditInReadonlyFlag() );
+ m_Data.SetEditInReadonlyFlag( pParentSect->IsEditInReadonlyFlag() );
// <--
}
- if( pFmt && !bProtectFlag )
- _SetProtectFlag( pFmt->GetProtect().IsCntntProtected() );
+ if (!m_Data.IsProtectFlag())
+ {
+ m_Data.SetProtectFlag( rFormat.GetProtect().IsCntntProtected() );
+ }
// --> FME 2004-06-22 #114856# edit in readonly sections
- if ( pFmt && !bEditInReadonlyFlag )
- _SetEditInReadonlyFlag( pFmt->GetEditInReadonly().GetValue() );
+ if (!m_Data.IsEditInReadonlyFlag())
+ {
+ m_Data.SetEditInReadonlyFlag( rFormat.GetEditInReadonly().GetValue() );
+ }
// <--
}
@@ -170,11 +256,15 @@ SwSection::~SwSection()
{
pFmt->Remove( this ); // austragen,
- if( CONTENT_SECTION != eType ) // den Link austragen
- pDoc->GetLinkManager().Remove( refLink );
+ if (CONTENT_SECTION != m_Data.GetType())
+ {
+ pDoc->GetLinkManager().Remove( m_RefLink );
+ }
- if( refObj.Is() ) // als Server austragen
- pDoc->GetLinkManager().RemoveServer( &refObj );
+ if (m_RefObj.Is())
+ {
+ pDoc->GetLinkManager().RemoveServer( &m_RefObj );
+ }
// ist die Section der letzte Client im Format, kann dieses
// geloescht werden
@@ -190,78 +280,56 @@ SwSection::~SwSection()
pDoc->DoUndo( bUndo );
}
}
- if( refObj.Is() )
- refObj->Closed();
+ if (m_RefObj.Is())
+ {
+ m_RefObj->Closed();
+ }
}
-
-SwSection& SwSection::operator=( const SwSection& rCpy )
+void SwSection::SetSectionData(SwSectionData const& rData)
{
- sSectionNm = rCpy.sSectionNm;
- sCondition = rCpy.sCondition;
- sLinkFileName = rCpy.GetLinkFileName();
- SetLinkFilePassWd( rCpy.GetLinkFilePassWd() );
- SetConnectFlag( rCpy.IsConnectFlag() );
- SetPasswd( rCpy.GetPasswd() );
-
- eType = rCpy.eType;
-
- if( !GetFmt() )
+ bool const bOldHidden( m_Data.IsHidden() );
+ m_Data = rData;
+ // now update format and reflink with new data
+// SetLinkFileName(m_Data.GetLinkFileName()); // old code did not do this?
+ // next 2 may actually overwrite m_Data.m_b{Protect,EditInReadonly}Flag
+ // in Modify, which should result in same flag value as the old code!
+ SetProtect(m_Data.IsProtectFlag());
+ SetEditInReadonly(m_Data.IsEditInReadonlyFlag());
+ if (bOldHidden != m_Data.IsHidden()) // check if changed...
{
- SetProtect( rCpy.IsProtect() );
- // --> FME 2004-06-22 #114856# edit in readonly sections
- SetEditInReadonly( rCpy.IsEditInReadonly() );
- // <--
+ ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden());
}
- else if( rCpy.GetFmt() )
- {
- _SetProtectFlag( rCpy.bProtectFlag );
- // --> FME 2004-06-22 #114856# edit in readonly sections
- _SetEditInReadonlyFlag( rCpy.bEditInReadonlyFlag );
- // <--
- }
- else
- {
- SetProtect( rCpy.bProtectFlag );
- // --> FME 2004-06-22 #114856# edit in readonly sections
- SetEditInReadonly( rCpy.bEditInReadonlyFlag );
- // <--
- }
-
- bCondHiddenFlag = TRUE; // sollte immer defaultet werden
- SetHidden( rCpy.bHidden );
-
- return *this;
}
-
-BOOL SwSection::operator==( const SwSection& rCmp ) const
+bool SwSection::DataEquals(SwSectionData const& rCmp) const
{
- return sSectionNm == rCmp.sSectionNm &&
- sCondition == rCmp.sCondition &&
- eType == rCmp.eType &&
- bHidden == rCmp.bHidden &&
- IsProtect() == rCmp.IsProtect() &&
- // --> FME 2004-06-22 #114856# edit in readonly sections
- IsEditInReadonly() == rCmp.IsEditInReadonly() &&
- // <--
- GetLinkFileName() == rCmp.GetLinkFileName() &&
- GetLinkFilePassWd() == rCmp.GetLinkFilePassWd() &&
- GetPasswd() == rCmp.GetPasswd() &&
- ( !GetFmt() || !rCmp.GetFmt() || GetFmt() == rCmp.GetFmt());
+ // note that the old code compared the flags of the parameter with the
+ // format attributes of this; the following mess should do the same...
+ (void) GetLinkFileName(); // updates m_sLinkFileName
+ bool const bProtect(m_Data.IsProtectFlag());
+ bool const bEditInReadonly(m_Data.IsEditInReadonlyFlag());
+ const_cast<SwSection*>(this)->m_Data.SetProtectFlag(IsProtect());
+ const_cast<SwSection*>(this)->m_Data
+ .SetEditInReadonlyFlag(IsEditInReadonly());
+ bool const bResult( m_Data == rCmp );
+ const_cast<SwSection*>(this)->m_Data.SetProtectFlag(bProtect);
+ const_cast<SwSection*>(this)->m_Data.SetEditInReadonlyFlag(bEditInReadonly);
+ return bResult;
}
-void SwSection::_SetHiddenFlag( BOOL bTmpHidden, BOOL bCondition )
+void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition)
{
SwSectionFmt* pFmt = GetFmt();
+ ASSERT(pFmt, "ImplSetHiddenFlag: no format?");
if( pFmt )
{
- BOOL bHide = bTmpHidden && bCondition;
+ const bool bHide = bTmpHidden && bCondition;
- if( bHide ) // die Nodes also "verstecken"
+ if (bHide) // should be hidden
{
- if( !bHiddenFlag ) // ist nicht versteckt
+ if (!m_Data.IsHiddenFlag()) // is not hidden
{
// wie sieht es mit dem Parent aus, ist der versteckt ?
// (eigentlich muesste das vom bHiddenFlag angezeigt werden!)
@@ -274,7 +342,7 @@ void SwSection::_SetHiddenFlag( BOOL bTmpHidden, BOOL bCondition )
pFmt->DelFrms();
}
}
- else if( bHiddenFlag ) // die Nodes wieder anzeigen
+ else if (m_Data.IsHiddenFlag()) // show Nodes again
{
// alle Frames sichtbar machen ( Childs Sections werden vom
// MakeFrms beruecksichtigt). Aber nur wenn die ParentSection
@@ -304,57 +372,76 @@ BOOL SwSection::CalcHiddenFlag() const
return FALSE;
}
-BOOL SwSection::_IsProtect() const
+bool SwSection::IsProtect() const
{
- return GetFmt()->GetProtect().IsCntntProtected();
+ SwSectionFmt *const pFmt( GetFmt() );
+ ASSERT(pFmt, "SwSection::IsProtect: no format?");
+ return (pFmt)
+ ? pFmt->GetProtect().IsCntntProtected()
+ : IsProtectFlag();
}
// --> FME 2004-06-22 #114856# edit in readonly sections
-BOOL SwSection::_IsEditInReadonly() const
+bool SwSection::IsEditInReadonly() const
{
- return GetFmt()->GetEditInReadonly().GetValue();
+ SwSectionFmt *const pFmt( GetFmt() );
+ ASSERT(pFmt, "SwSection::IsEditInReadonly: no format?");
+ return (pFmt)
+ ? pFmt->GetEditInReadonly().GetValue()
+ : IsEditInReadonlyFlag();
}
// <--
-void SwSection::SetHidden( BOOL bFlag )
+void SwSection::SetHidden(bool const bFlag)
{
- if( !bHidden == !bFlag )
+ if (!m_Data.IsHidden() == !bFlag)
return;
- bHidden = bFlag;
- _SetHiddenFlag( bHidden, bCondHiddenFlag );
+ m_Data.SetHidden(bFlag);
+ ImplSetHiddenFlag(bFlag, m_Data.IsCondHidden());
}
-void SwSection::SetProtect( BOOL bFlag )
+void SwSection::SetProtect(bool const bFlag)
{
- if( GetFmt() )
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::SetProtect: no format?");
+ if (pFormat)
{
SvxProtectItem aItem( RES_PROTECT );
aItem.SetCntntProtect( (BOOL)bFlag );
- GetFmt()->SetFmtAttr( aItem );
+ pFormat->SetFmtAttr( aItem );
+ // note: this will call m_Data.SetProtectFlag via Modify!
}
else
- bProtectFlag = bFlag;
+ {
+ m_Data.SetProtectFlag(bFlag);
+ }
}
// --> FME 2004-06-22 #114856# edit in readonly sections
-void SwSection::SetEditInReadonly( BOOL bFlag )
+void SwSection::SetEditInReadonly(bool const bFlag)
{
- if( GetFmt() )
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::SetEditInReadonly: no format?");
+ if (pFormat)
{
SwFmtEditInReadonly aItem;
aItem.SetValue( (BOOL)bFlag );
- GetFmt()->SetFmtAttr( aItem );
+ pFormat->SetFmtAttr( aItem );
+ // note: this will call m_Data.SetEditInReadonlyFlag via Modify!
}
else
- bEditInReadonlyFlag = bFlag;
+ {
+ m_Data.SetEditInReadonlyFlag(bFlag);
+ }
}
// <--
void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
{
- BOOL bRemake = FALSE, bUpdateFtn = FALSE;
+ bool bRemake = false;
+ bool bUpdateFtn = false;
switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
{
case RES_ATTRSET_CHG:
@@ -366,7 +453,8 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
if( SFX_ITEM_SET == pNewSet->GetItemState(
RES_PROTECT, FALSE, &pItem ) )
{
- _SetProtectFlag( ((SvxProtectItem*)pItem)->IsCntntProtected() );
+ m_Data.SetProtectFlag( static_cast<SvxProtectItem const*>(pItem)
+ ->IsCntntProtected() );
pNewSet->ClearItem( RES_PROTECT );
pOldSet->ClearItem( RES_PROTECT );
}
@@ -375,7 +463,8 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
if( SFX_ITEM_SET == pNewSet->GetItemState(
RES_EDIT_IN_READONLY, FALSE, &pItem ) )
{
- _SetEditInReadonlyFlag( ((SwFmtEditInReadonly*)pItem)->GetValue() );
+ m_Data.SetEditInReadonlyFlag(
+ static_cast<SwFmtEditInReadonly const*>(pItem)->GetValue());
pNewSet->ClearItem( RES_EDIT_IN_READONLY );
pOldSet->ClearItem( RES_EDIT_IN_READONLY );
}
@@ -385,7 +474,9 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
RES_FTN_AT_TXTEND, FALSE, &pItem ) ||
SFX_ITEM_SET == pNewSet->GetItemState(
RES_END_AT_TXTEND, FALSE, &pItem ))
- bUpdateFtn = TRUE;
+ {
+ bUpdateFtn = true;
+ }
if( !pNewSet->Count() )
return;
@@ -395,7 +486,8 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
case RES_PROTECT:
if( pNew )
{
- BOOL bNewFlag = ((SvxProtectItem*)pNew)->IsCntntProtected();
+ bool bNewFlag =
+ static_cast<SvxProtectItem*>(pNew)->IsCntntProtected();
if( !bNewFlag )
{
// Abschalten: teste ob nicht vielleich ueber die Parents
@@ -404,32 +496,34 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
do {
if( pSect->IsProtect() )
{
- bNewFlag = TRUE;
+ bNewFlag = true;
break;
}
- } while( 0 != ( pSect = pSect->GetParent()) );
+ pSect = pSect->GetParent();
+ } while (pSect);
}
- _SetProtectFlag( bNewFlag );
+ m_Data.SetProtectFlag( bNewFlag );
}
return;
// --> FME 2004-06-22 #114856# edit in readonly sections
case RES_EDIT_IN_READONLY:
if( pNew )
{
- BOOL bNewFlag = ((SwFmtEditInReadonly*)pNew)->GetValue();
- _SetEditInReadonlyFlag( bNewFlag );
+ const bool bNewFlag =
+ static_cast<SwFmtEditInReadonly*>(pNew)->GetValue();
+ m_Data.SetEditInReadonlyFlag( bNewFlag );
}
return;
// <--
case RES_SECTION_HIDDEN:
- bHiddenFlag = TRUE;
+ m_Data.SetHiddenFlag(true);
return;
case RES_SECTION_NOT_HIDDEN:
case RES_SECTION_RESETHIDDENFLAG:
- bHiddenFlag = bHidden && bCondHiddenFlag;
+ m_Data.SetHiddenFlag( m_Data.IsHidden() && m_Data.IsCondHidden() );
return;
case RES_COL:
@@ -438,12 +532,16 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
case RES_FTN_AT_TXTEND:
if( pNew && pOld )
- bUpdateFtn = TRUE;
+ {
+ bUpdateFtn = true;
+ }
break;
case RES_END_AT_TXTEND:
if( pNew && pOld )
- bUpdateFtn = TRUE;
+ {
+ bUpdateFtn = true;
+ }
break;
}
@@ -464,38 +562,38 @@ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
void SwSection::SetRefObject( SwServerObject* pObj )
{
- refObj = pObj;
+ m_RefObj = pObj;
}
-void SwSection::SetCondHidden( BOOL bFlag )
+void SwSection::SetCondHidden(bool const bFlag)
{
- if( !bCondHiddenFlag == !bFlag )
+ if (!m_Data.IsCondHidden() == !bFlag)
return;
- bCondHiddenFlag = bFlag;
- _SetHiddenFlag( bHidden, bCondHiddenFlag );
+ m_Data.SetCondHidden(bFlag);
+ ImplSetHiddenFlag(m_Data.IsHidden(), bFlag);
}
// setze/erfrage den gelinkten FileNamen
const String& SwSection::GetLinkFileName() const
{
- if( refLink.Is() )
+ if (m_RefLink.Is())
{
String sTmp;
- switch( eType )
+ switch (m_Data.GetType())
{
case DDE_LINK_SECTION:
- sTmp = refLink->GetLinkSourceName();
+ sTmp = m_RefLink->GetLinkSourceName();
break;
case FILE_LINK_SECTION:
{
String sRange, sFilter;
- if( refLink->GetLinkManager() &&
- refLink->GetLinkManager()->GetDisplayNames(
- refLink, 0, &sTmp, &sRange, &sFilter ) )
+ if (m_RefLink->GetLinkManager() &&
+ m_RefLink->GetLinkManager()->GetDisplayNames(
+ m_RefLink, 0, &sTmp, &sRange, &sFilter ))
{
( sTmp += sfx2::cTokenSeperator ) += sFilter;
( sTmp += sfx2::cTokenSeperator ) += sRange;
@@ -505,26 +603,29 @@ const String& SwSection::GetLinkFileName() const
// ist die Section im UndoNodesArray, dann steht
// der Link nicht im LinkManager, kann also auch nicht
// erfragt werden. Dann returne den akt. Namen
- return sLinkFileName;
+ return m_Data.GetLinkFileName();
}
}
break;
default: break;
}
- ((SwSection*)this)->sLinkFileName = sTmp;
+ const_cast<SwSection*>(this)->m_Data.SetLinkFileName(sTmp);
}
- return sLinkFileName;
+ return m_Data.GetLinkFileName();
}
-void SwSection::SetLinkFileName( const String& rNew, const String* pPassWd )
+void SwSection::SetLinkFileName(const String& rNew, String const*const pPassWd)
{
- if( refLink.Is() )
- refLink->SetLinkSourceName( rNew );
- else
- sLinkFileName = rNew;
+ if (m_RefLink.Is())
+ {
+ m_RefLink->SetLinkSourceName( rNew );
+ }
+ m_Data.SetLinkFileName(rNew);
if( pPassWd )
- SetLinkFilePassWd( *pPassWd );
+ {
+ SetLinkFilePassword( *pPassWd );
+ }
}
// falls es ein gelinkter Bereich war, dann muessen alle
@@ -563,6 +664,8 @@ const SwTOXBase* SwSection::GetTOXBase() const
return pRet;
}
+// SwSectionFmt ========================================================
+
SwSectionFmt::SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc )
: SwFrmFmt( pDoc->GetAttrPool(), sSectionFmtNm, pDrvdFrm )
{
@@ -594,7 +697,7 @@ SwSectionFmt::~SwSectionFmt()
if( !pParentSect || !pParentSect->IsHiddenFlag() )
{
// Nodes wieder anzeigen
- rSect.SetHidden( FALSE );
+ rSect.SetHidden(false);
}
}
SwClientIter aIter( *this );
@@ -621,7 +724,7 @@ SwSectionFmt::~SwSectionFmt()
}
-SwSectionPtr SwSectionFmt::_GetSection() const
+SwSection * SwSectionFmt::GetSection() const
{
if( GetDepends() )
{
@@ -908,7 +1011,8 @@ extern "C" {
const SwSectionPtr pFSect = *(SwSectionPtr*)pFirst;
const SwSectionPtr pSSect = *(SwSectionPtr*)pSecond;
ASSERT( pFSect && pSSect, "ungueltige Sections" );
- StringCompare eCmp = pFSect->GetName().CompareTo( pSSect->GetName() );
+ StringCompare const eCmp =
+ pFSect->GetSectionName().CompareTo( pSSect->GetSectionName() );
return eCmp == COMPARE_EQUAL ? 0
: eCmp == COMPARE_LESS ? 1 : -1;
}
@@ -923,7 +1027,7 @@ USHORT SwSectionFmt::GetChildSections( SwSections& rArr,
if( GetDepends() )
{
- SwClientIter aIter( *(SwSectionFmt*)this );
+ SwClientIter aIter( *this );
SwClient * pLast;
const SwNodeIndex* pIdx;
for( pLast = aIter.First(TYPE(SwSectionFmt)); pLast; pLast = aIter.Next() )
@@ -979,7 +1083,7 @@ void SwSectionFmt::UpdateParent() // Parent wurde veraendert
// --> FME 2004-06-22 #114856# edit in readonly sections
const SwFmtEditInReadonly* pEditInReadonly = 0;
// <--
- int bIsHidden = FALSE;
+ bool bIsHidden = false;
SwClientIter aIter( *this );
SwClient * pLast = aIter.GoStart();
@@ -1008,16 +1112,20 @@ void SwSectionFmt::UpdateParent() // Parent wurde veraendert
bIsHidden = pSection->IsHidden();
}
}
- if( pProtect->IsCntntProtected() !=
- pSection->IsProtectFlag() )
+ if (!pProtect->IsCntntProtected() !=
+ !pSection->IsProtectFlag())
+ {
pLast->Modify( (SfxPoolItem*)pProtect,
(SfxPoolItem*)pProtect );
+ }
// --> FME 2004-06-22 #114856# edit in readonly sections
- if ( pEditInReadonly->GetValue() !=
- pSection->IsEditInReadonlyFlag() )
+ if (!pEditInReadonly->GetValue() !=
+ !pSection->IsEditInReadonlyFlag())
+ {
pLast->Modify( (SfxPoolItem*)pEditInReadonly,
(SfxPoolItem*)pEditInReadonly );
+ }
// <--
if( bIsHidden == pSection->IsHiddenFlag() )
@@ -1054,7 +1162,7 @@ void SwSectionFmt::UpdateParent() // Parent wurde veraendert
}
-SwSectionNode* SwSectionFmt::GetSectionNode( BOOL bAlways )
+SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways)
{
const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx();
if( pIdx && ( bAlways || &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
@@ -1076,6 +1184,49 @@ const SwSection* SwSectionFmt::GetGlobalDocSection() const
return 0;
}
+// sw::Metadatable
+::sfx2::IXmlIdRegistry& SwSectionFmt::GetRegistry()
+{
+ return GetDoc()->GetXmlIdRegistry();
+}
+
+bool SwSectionFmt::IsInClipboard() const
+{
+ return GetDoc()->IsClipBoard();
+}
+
+bool SwSectionFmt::IsInUndo() const
+{
+ return !IsInNodesArr();
+}
+
+bool SwSectionFmt::IsInContent() const
+{
+ SwNodeIndex const*const pIdx = GetCntnt(FALSE).GetCntntIdx();
+ OSL_ENSURE(pIdx, "SwSectionFmt::IsInContent: no index?");
+ return (pIdx) ? !GetDoc()->IsInHeaderFooter(*pIdx) : true;
+}
+
+// n.b.: if the section format represents an index, then there is both a
+// SwXDocumentIndex and a SwXTextSection instance for this single core object.
+// these two can both implement XMetadatable and forward to the same core
+// section format. but here only one UNO object can be returned,
+// so always return the text section.
+uno::Reference< rdf::XMetadatable >
+SwSectionFmt::MakeUnoObject()
+{
+ uno::Reference<rdf::XMetadatable> xMeta;
+ SwSection *const pSection( GetSection() );
+ if (pSection)
+ {
+ xMeta.set( SwXTextSection::CreateXTextSection(this,
+ TOX_HEADER_SECTION == pSection->GetType()),
+ uno::UNO_QUERY );
+ }
+ return xMeta;
+}
+
+
// --> OD 2007-02-14 #b6521322#
// Method to break section links inside a linked section
void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
@@ -1330,7 +1481,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
}
SwSection& rSection = pSectNd->GetSection();
- rSection.SetConnectFlag( FALSE );
+ rSection.SetConnectFlag(false);
::rtl::OUString sNewFileName;
Reader* pRead = 0;
@@ -1362,7 +1513,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
else
{
nRet = lcl_FindDocShell( xDocSh, sFileName,
- rSection.GetLinkFilePassWd(),
+ rSection.GetLinkFilePassword(),
sFilter, 0, pDoc->GetDocShell() );
if( nRet )
{
@@ -1374,18 +1525,18 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
if( nRet )
{
- rSection.SetConnectFlag( TRUE );
+ rSection.SetConnectFlag(true);
SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
SwNodeRange* pCpyRg = 0;
if( xDocSh->GetMedium() &&
- !rSection.GetLinkFilePassWd().Len() )
+ !rSection.GetLinkFilePassword().Len() )
{
const SfxPoolItem* pItem;
if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()->
GetItemState( SID_PASSWORD, FALSE, &pItem ) )
- rSection.SetLinkFilePassWd(
+ rSection.SetLinkFilePassword(
((SfxStringItem*)pItem)->GetValue() );
}
@@ -1518,7 +1669,9 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
SwReader aTmpReader( aStrm, aEmptyStr, pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam );
if( !IsError( aTmpReader.Read( *pRead ) ))
- rSection.SetConnectFlag( TRUE );
+ {
+ rSection.SetConnectFlag(true);
+ }
if( pESh )
{
@@ -1565,19 +1718,18 @@ void SwIntrnlSectRefLink::Closed()
else
pSh->StartAction();
- SwSection aSect( CONTENT_SECTION, aEmptyStr );
- aSect = *rSectFmt.GetSection();
- aSect.SetType( CONTENT_SECTION );
- aSect.SetLinkFileName( aEmptyStr );
- aSect.SetHidden( FALSE );
- aSect.SetProtect( FALSE );
+ SwSectionData aSectionData(*rSectFmt.GetSection());
+ aSectionData.SetType( CONTENT_SECTION );
+ aSectionData.SetLinkFileName( aEmptyStr );
+ aSectionData.SetHidden( false );
+ aSectionData.SetProtectFlag( false );
// --> FME 2004-06-22 #114856# edit in readonly sections
- aSect.SetEditInReadonly( FALSE );
+ aSectionData.SetEditInReadonlyFlag( false );
// <--
- aSect.SetConnectFlag( FALSE );
+ aSectionData.SetConnectFlag( false );
- pDoc->ChgSection( n, aSect );
+ pDoc->UpdateSection( n, aSectionData );
// alle in der Section liegenden Links werden sichtbar
SwSectionNode* pSectNd = rSectFmt.GetSectionNode( FALSE );
@@ -1598,21 +1750,26 @@ void SwIntrnlSectRefLink::Closed()
void SwSection::CreateLink( LinkCreateType eCreateType )
{
SwSectionFmt* pFmt = GetFmt();
- if( !pFmt || CONTENT_SECTION == eType )
+ ASSERT(pFmt, "SwSection::CreateLink: no format?");
+ if (!pFmt || (CONTENT_SECTION == m_Data.GetType()))
return ;
USHORT nUpdateType = sfx2::LINKUPDATE_ALWAYS;
- if( !refLink.Is() )
- // dann mal den BaseLink aufbauen
- refLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
+ if (!m_RefLink.Is())
+ {
+ // create BaseLink
+ m_RefLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
+ }
else
- // sonst aus dem Linkmanager entfernen
- pFmt->GetDoc()->GetLinkManager().Remove( refLink );
+ {
+ pFmt->GetDoc()->GetLinkManager().Remove( m_RefLink );
+ }
- SwIntrnlSectRefLink* pLnk = (SwIntrnlSectRefLink*)&refLink;
+ SwIntrnlSectRefLink *const pLnk =
+ static_cast<SwIntrnlSectRefLink*>(& m_RefLink);
- String sCmd( sLinkFileName );
+ String sCmd( m_Data.GetLinkFileName() );
xub_StrLen nPos;
while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
sCmd.Erase( nPos, 1 );
@@ -1620,7 +1777,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType )
pLnk->SetUpdateMode( nUpdateType );
pLnk->SetVisible( pFmt->GetDoc()->IsVisibleLinks() );
- switch( eType )
+ switch (m_Data.GetType())
{
case DDE_LINK_SECTION:
pLnk->SetLinkSourceName( sCmd );
@@ -1632,7 +1789,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType )
String sFltr( sCmd.GetToken( 1, sfx2::cTokenSeperator ) );
String sRange( sCmd.GetToken( 2, sfx2::cTokenSeperator ) );
pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk,
- static_cast<USHORT>(eType),
+ static_cast<USHORT>(m_Data.GetType()),
sCmd.GetToken( 0, sfx2::cTokenSeperator ),
( sFltr.Len() ? &sFltr : 0 ),
( sRange.Len() ? &sRange : 0 ) );
@@ -1668,19 +1825,21 @@ void SwSection::BreakLink()
}
// release link, if it exists
- if ( refLink.Is() )
+ if (m_RefLink.Is())
{
- if ( GetFmt() )
+ SwSectionFmt *const pFormat( GetFmt() );
+ ASSERT(pFormat, "SwSection::BreakLink: no format?");
+ if (pFormat)
{
- GetFmt()->GetDoc()->GetLinkManager().Remove( refLink );
+ pFormat->GetDoc()->GetLinkManager().Remove( m_RefLink );
}
- refLink.Clear();
+ m_RefLink.Clear();
}
// change type
SetType( CONTENT_SECTION );
// reset linked file data
SetLinkFileName( aEmptyStr );
- SetLinkFilePassWd( aEmptyStr );
+ SetLinkFilePassword( aEmptyStr );
}
// <--
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 96f15ba22be8..f7242d1d8132 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -1004,10 +1004,6 @@ void SwDrawView::CheckPossibilities()
}
if ( pFrm )
bProtect = pFrm->IsProtected(); //Rahmen, Bereiche usw.
- // --> OD 2006-11-06 #130889# - make code robust
-// if ( FLY_IN_CNTNT == ::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() &&
-// rMrkList.GetMarkCount() > 1 )
-// bProtect = TRUE;
{
SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) );
if ( !pFrmFmt )
@@ -1022,7 +1018,6 @@ void SwDrawView::CheckPossibilities()
bProtect = TRUE;
}
}
- // <--
}
bMoveProtect |= bProtect;
bResizeProtect |= bProtect | bSzProtect;
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 9e1cf28f0eb1..37ba5e5ced31 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -31,14 +31,10 @@
#include <hintids.hxx>
-#ifndef _SVX_TSTPITEM_HXX //autogen
#include <editeng/tstpitem.hxx>
-#endif
#include <editeng/lrspitem.hxx>
#include <editeng/scripttypeitem.hxx>
-#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
#include <com/sun/star/i18n/ScriptType.hdl>
-#endif
#include <txatbase.hxx>
#include <txtftn.hxx>
#include <fmtftn.hxx>
@@ -230,8 +226,8 @@ BOOL SwEditShell::GetCurFtn( SwFmtFtn* pFillFtn )
if( !pTxtNd )
return FALSE;
- SwTxtAttr *pFtn = pTxtNd->GetTxtAttr( pCrsr->GetPoint()->nContent,
- RES_TXTATR_FTN );
+ SwTxtAttr *const pFtn = pTxtNd->GetTxtAttrForCharAt(
+ pCrsr->GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
if( pFtn && pFillFtn )
{
// Daten vom Attribut uebertragen
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index 5ecc92e79acb..6f884f244326 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -146,7 +146,7 @@ USHORT SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
}
BOOL SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
- const SwSection& rNew )
+ SwSectionData & rNew)
{
if( !getIDocumentSettingAccess()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
return FALSE;
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 6ad8337e063a..ba3c2e9c7966 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -42,9 +42,9 @@
#include <rootfrm.hxx> // SwRootFrm
- // SS fuer Bereiche
-const SwSection* SwEditShell::InsertSection( const SwSection& rNew,
- const SfxItemSet* pAttr )
+SwSection const*
+SwEditShell::InsertSection(
+ SwSectionData & rNewData, SfxItemSet const*const pAttr)
{
const SwSection* pRet = 0;
if( !IsTableMode() )
@@ -53,8 +53,8 @@ const SwSection* SwEditShell::InsertSection( const SwSection& rNew,
GetDoc()->StartUndo( UNDO_INSSECTION, NULL );
FOREACHPAM_START(this)
- const SwSection* const pNew =
- GetDoc()->InsertSwSection( *PCURCRSR, rNew, pAttr );
+ SwSection const*const pNew =
+ GetDoc()->InsertSwSection( *PCURCRSR, rNewData, 0, pAttr );
if( !pRet )
pRet = pNew;
FOREACHPAM_END()
@@ -178,11 +178,11 @@ void SwEditShell::DelSectionFmt( USHORT nFmt )
}
-void SwEditShell::ChgSection( USHORT nSect, const SwSection& rSect,
- const SfxItemSet* pAttr )
+void SwEditShell::UpdateSection(sal_uInt16 const nSect,
+ SwSectionData & rNewData, SfxItemSet const*const pAttr)
{
StartAllAction();
- GetDoc()->ChgSection( nSect, rSect, pAttr );
+ GetDoc()->UpdateSection( nSect, rNewData, pAttr );
// rufe das AttrChangeNotify auf der UI-Seite.
CallChgLnk();
EndAllAction();
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index d6fb64577e11..230e45f71079 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -135,10 +135,9 @@ void SwEditShell::SetTOXBaseReadonly(const SwTOXBase& rTOXBase, BOOL bReadonly)
((SwTOXBase&)rTOXBase).SetProtected(bReadonly);
ASSERT( rTOXSect.SwSection::GetType() == TOX_CONTENT_SECTION, "not a TOXContentSection" );
- SwSection aSect(TOX_CONTENT_SECTION, rTOXSect.GetName());
- aSect = rTOXSect;
- aSect.SetProtect(bReadonly);
- ChgSection( GetSectionFmtPos( *rTOXSect.GetFmt() ), aSect, 0 );
+ SwSectionData aSectionData(rTOXSect);
+ aSectionData.SetProtectFlag(bReadonly);
+ UpdateSection( GetSectionFmtPos( *rTOXSect.GetFmt() ), aSectionData, 0 );
}
/* -----------------02.09.99 07:47-------------------
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index 964a5a11cce4..0c9f8f2980bf 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -32,7 +32,8 @@
#include <postithelper.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
+#include <AnnotationWin.hxx>
+
#include <fmtfld.hxx>
#include <txtfld.hxx>
#include <docufld.hxx>
@@ -41,12 +42,50 @@
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <txtfrm.hxx>
+#include <tabfrm.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <redline.hxx>
#include <scriptinfo.hxx>
#include <editeng/charhiddenitem.hxx>
+namespace {
+
+struct LayoutInfoOrder
+{
+ bool operator()( const SwLayoutInfo& rLayoutInfo,
+ const SwLayoutInfo& rNewLayoutInfo )
+ {
+ if ( rLayoutInfo.mnPageNumber != rNewLayoutInfo.mnPageNumber )
+ {
+ // corresponding <SwFrm> instances are on different pages
+ return rLayoutInfo.mnPageNumber < rNewLayoutInfo.mnPageNumber;
+ }
+ else
+ {
+ // corresponding <SwFrm> instances are in different repeating table header rows
+ ASSERT( rLayoutInfo.mpAnchorFrm->FindTabFrm(),
+ "<LayoutInfoOrder::operator()> - table frame not found" );
+ ASSERT( rNewLayoutInfo.mpAnchorFrm->FindTabFrm(),
+ "<LayoutInfoOrder::operator()> - table frame not found" );
+ const SwTabFrm* pLayoutInfoTabFrm( rLayoutInfo.mpAnchorFrm->FindTabFrm() );
+ const SwTabFrm* pNewLayoutInfoTabFrm( rNewLayoutInfo.mpAnchorFrm->FindTabFrm() );
+ const SwTabFrm* pTmpTabFrm( pNewLayoutInfoTabFrm );
+ while ( pTmpTabFrm && pTmpTabFrm->GetFollow() )
+ {
+ pTmpTabFrm = static_cast<const SwTabFrm*>(pTmpTabFrm->GetFollow()->GetFrm());
+ if ( pTmpTabFrm == pLayoutInfoTabFrm )
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+};
+
+} // eof anonymous namespace
+
SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLayoutInfo >& rInfo, SwPosition& rPos )
{
SwLayoutStatus aRet = INVISIBLE;
@@ -67,11 +106,12 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
{
SwLayoutInfo aInfo;
pTxtFrm->GetCharRect( aInfo.mPosition, rPos, 0 );
+ aInfo.mpAnchorFrm = pTxtFrm;
aInfo.mPageFrame = pPage->Frm();
aInfo.mPagePrtArea = pPage->Prt();
aInfo.mPagePrtArea.Pos() += aInfo.mPageFrame.Pos();
aInfo.mnPageNumber = pPage->GetPhyPageNum();
- aInfo.mbMarginSide = pPage->MarginSide();
+ aInfo.meSidebarPosition = pPage->SidebarPosition();
aInfo.mRedlineAuthor = 0;
if( aRet == INVISIBLE )
@@ -91,7 +131,14 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
}
}
}
- rInfo.push_back( aInfo );
+
+ {
+ std::vector< SwLayoutInfo >::iterator aInsPosIter =
+ std::lower_bound( rInfo.begin(), rInfo.end(),
+ aInfo, LayoutInfoOrder() );
+
+ rInfo.insert( aInsPosIter, aInfo );
+ }
}
}
}
@@ -142,7 +189,7 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos( std::vector< SwLa
return aRet;
}
-SwPosition SwPostItItem::GetPosition()
+SwPosition SwAnnotationItem::GetAnchorPosition() const
{
SwTxtFld* pFld = pFmtFld->GetTxtFld();
//if( pFld )
@@ -157,23 +204,30 @@ SwPosition SwPostItItem::GetPosition()
//}
}
-bool SwPostItItem::UseElement()
+bool SwAnnotationItem::UseElement()
{
return pFmtFld->IsFldInDoc();
}
-SwMarginWin* SwPostItItem::GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
+sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
+ SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits)
{
- return new SwPostIt(pParent,nBits,pFmtFld,aMgr,aBits);
+ return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
+ aMgr, aBits,
+ *this,
+ pFmtFld );
}
/*
-SwPosition SwRedCommentItem::GetPosition()
+SwPosition SwRedCommentItem::GetAnchorPosition()
{
return *pRedline->Start();
}
-SwMarginWin* SwRedCommentItem::GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
+SwSidebarWin* SwRedCommentItem::GetSidebarWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
{
return new SwRedComment(pParent,nBits,aMgr,aBits,pRedline);
}
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 4df81e2e188e..9fe5c9a22204 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -182,8 +182,9 @@ BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
// das kopierte TextAttribut wieder entfernt werden,
// sonst wird es als TextSelektion erkannt
const SwIndex& rIdx = pFlyFmt->GetAnchor().GetCntntAnchor()->nContent;
- SwTxtFlyCnt* pTxtFly = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr(
- rIdx, RES_TXTATR_FLYCNT );
+ SwTxtFlyCnt *const pTxtFly = static_cast<SwTxtFlyCnt *>(
+ pTxtNd->GetTxtAttrForCharAt(
+ rIdx.GetIndex(), RES_TXTATR_FLYCNT));
if( pTxtFly )
{
((SwFmtFlyCnt&)pTxtFly->GetFlyCnt()).SetFlyFmt( 0 );
@@ -835,8 +836,8 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
pClpDoc->CopyRange( rCopy, rInsPos, false );
{
aIndexBefore++;
- SwPaM aPaM(SwPosition(aIndexBefore, 0),
- SwPosition(rInsPos.nNode, 0));
+ SwPaM aPaM(SwPosition(aIndexBefore),
+ SwPosition(rInsPos.nNode));
aPaM.GetDoc()->MakeUniqueNumRules(aPaM);
}
}
@@ -1065,8 +1066,8 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames )
{
aIndexBefore++;
- SwPaM aPaM(SwPosition(aIndexBefore, 0),
- SwPosition(rInsPos.nNode, 0));
+ SwPaM aPaM(SwPosition(aIndexBefore),
+ SwPosition(rInsPos.nNode));
aPaM.GetDoc()->MakeUniqueNumRules(aPaM);
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index a0d9141778cb..0dc721a62f12 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1801,11 +1801,6 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const
else
eType = OBJCNT_FLY;
}
- // --> OD 2006-11-06 #130889# - make code robust
-// else if( pInvestigatedObj->ISA( SdrObjGroup ) &&
-// FLY_IN_CNTNT !=
-// ((SwDrawContact*)GetUserCall(pInvestigatedObj))->GetFmt()->GetAnchor().GetAnchorId() )
-// eType = OBJCNT_GROUPOBJ;
else if ( pInvestigatedObj->ISA( SdrObjGroup ) )
{
SwDrawContact* pDrawContact( dynamic_cast<SwDrawContact*>(GetUserCall( pInvestigatedObj ) ) );
@@ -1830,7 +1825,6 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const
}
}
}
- // <--
else
eType = OBJCNT_SIMPLE;
return eType;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 7242ca411616..190cb5ecdf36 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2322,12 +2322,6 @@ bool SwFEShell::IsGroupAllowed() const
else
pUpGroup = pObj->GetUpGroup();
- // --> OD 2006-11-06 #130889# - make code robust
-// if ( bIsGroupAllowed &&
-// FLY_IN_CNTNT == ::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() )
-// {
-// bIsGroupAllowed = false;
-// }
if ( bIsGroupAllowed )
{
SwFrmFmt* pFrmFmt( ::FindFrmFmt( const_cast<SdrObject*>(pObj) ) );
@@ -2342,7 +2336,6 @@ bool SwFEShell::IsGroupAllowed() const
bIsGroupAllowed = false;
}
}
- // <--
// OD 27.06.2003 #108784# - check, if all selected objects are in the
// same header/footer or not in header/footer.
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index f737cecafd65..fb479fc86549 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -51,6 +51,10 @@ public:
virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const;
virtual void CheckDirection( BOOL bVert );
+ // --> OD 2010-02-17 #i103961#
+ virtual void Cut();
+ // <--
+
const SwTableBox *GetTabBox() const { return pTabBox; }
// used for breaking table rows:
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 1372a82dbb6e..cb03e0531000 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -96,7 +96,7 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection
SwTxtFmtColl* GetTxtFmtColl( USHORT nLevel );
public:
- SwTOXBaseSection( const SwTOXBase& rBase );
+ SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt);
virtual ~SwTOXBaseSection();
// OD 19.03.2003 #106329# - add parameter <_bNewTOX> in order to distinguish
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 35e2ad6853bb..bc2fef9b8be4 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -33,6 +33,8 @@
#include "ftnboss.hxx"
#include <tools/mempool.hxx>
+#include <SidebarWindowsTypes.hxx>
+
class SwFlyFrm;
class SwFlyFrmFmt;
class SwPageDesc;
@@ -383,7 +385,7 @@ public:
static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
ViewShell* _pViewShell,
SwRect& _orBorderAndShadowBoundRect,
- bool bRightSidebar );
+ const bool bRightSidebar );
static void PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, USHORT nPageNum, bool bRight);
static void PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown);
@@ -393,7 +395,7 @@ public:
asks the page on which side a margin should be shown, e.g for notes
returns true for left side, false for right side
*/
- bool MarginSide() const;
+ sw::sidebarwindows::SidebarPosition SidebarPosition() const;
virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
index 771be61acc12..1f5c74612a81 100755
--- a/sw/source/core/inc/unometa.hxx
+++ b/sw/source/core/inc/unometa.hxx
@@ -33,12 +33,13 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase6.hxx>
#include <sfx2/Metadatable.hxx>
@@ -57,10 +58,11 @@ namespace sw {
class MetaField;
}
-typedef ::cppu::ImplInheritanceHelper5
+typedef ::cppu::ImplInheritanceHelper6
< ::sfx2::MetadatableMixin
, ::com::sun::star::lang::XUnoTunnel
, ::com::sun::star::lang::XServiceInfo
+, ::com::sun::star::container::XChild
, ::com::sun::star::container::XEnumerationAccess
, ::com::sun::star::text::XTextContent
, ::com::sun::star::text::XText
@@ -151,6 +153,17 @@ public:
::com::sun::star::lang::XEventListener > & xListener)
throw (::com::sun::star::uno::RuntimeException);
+ // XChild
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > SAL_CALL
+ getParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface> const& xParent)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::NoSupportException);
+
// XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
throw (::com::sun::star::uno::RuntimeException);
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index 38fb3e2bac7a..0f89b3b75663 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -35,8 +35,8 @@
#include <tools/string.hxx>
-#include "swtypes.hxx"
-#include "swrect.hxx"
+#include <swtypes.hxx>
+#include <swrect.hxx>
class ViewShell;
class SwFlyFrm;
@@ -54,17 +54,10 @@ class SwAccessibleMap;
class SdrObject;
class Fraction;
class SwPrtOptions;
-// OD 12.12.2002 #103492#
class SwPagePreviewLayout;
-// OD 15.01.2003 #103492#
-#ifndef _PREVWPAGE_HXX
-#include <prevwpage.hxx>
-#endif
-// OD 15.01.2003 #103492#
+struct PrevwPage;
#include <vector>
-// --> OD 2005-12-01 #i27138#
class SwTxtFrm;
-// <--
class SwViewImp
{
@@ -175,7 +168,7 @@ private:
*/
void _InvalidateAccessibleParaTextSelection();
- /** invalidate attributes for paragraphs
+ /** invalidate attributes for paragraphs and paragraph's characters
OD 2009-01-06 #i88069#
implementation for wrapper method
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 5c16c1171397..2f8c8047c96e 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -57,7 +57,13 @@ public:
: maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList) {}
};
-enum WrongListType { WRONGLIST_SPELL, WRONGLIST_GRAMMAR, WRONGLIST_SMARTTAG };
+enum WrongListType
+{
+ WRONGLIST_SPELL,
+ WRONGLIST_GRAMMAR,
+ WRONGLIST_SMARTTAG,
+ WRONGLIST_CHANGETRACKING
+};
class SwWrongList
{
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 14bc23bb97a4..1475a3909220 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1460,15 +1460,23 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect )
//mod #i6193# added sidebar width
const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr();
const int nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
- if (pPageFrm->MarginSide())
+ switch ( pPageFrm->SidebarPosition() )
{
- aPaint.Left( aPaint.Left() - nBorderWidth - nSidebarWidth);
- aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth);
- }
- else
- {
- aPaint.Left( aPaint.Left() - nBorderWidth );
- aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth + nSidebarWidth);
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ aPaint.Left( aPaint.Left() - nBorderWidth - nSidebarWidth);
+ aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth);
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ aPaint.Left( aPaint.Left() - nBorderWidth );
+ aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth + nSidebarWidth);
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_NONE:
+ // nothing to do
+ break;
}
aPaint.Top( aPaint.Top() - nBorderWidth );
aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth);
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index a2d32b3ab3bc..72976a786fa1 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -300,7 +300,7 @@ SwPageFrm::~SwPageFrm()
pImp->GetLayAction().SetAgain();
// OD 12.02.2003 #i9719#, #105645# - retouche area of page
// including border and shadow area.
- const bool bRightSidebar = !MarginSide();
+ const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aRetoucheRect;
SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, bRightSidebar );
pSh->AddPaintRect( aRetoucheRect );
@@ -655,7 +655,7 @@ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
{
// OD 12.02.2003 #i9719#, #105645# - consider border and shadow of
// page frame for determine 'old' rectangle - it's used for invalidating.
- const bool bRightSidebar = !MarginSide();
+ const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aOldRectWithBorderAndShadow;
SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow, bRightSidebar );
pSh->InvalidateWindows( aOldRectWithBorderAndShadow );
@@ -1386,17 +1386,19 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn )
}
// false = right, true = left
-bool SwPageFrm::MarginSide() const
+sw::sidebarwindows::SidebarPosition SwPageFrm::SidebarPosition() const
{
if (!GetShell() || GetShell()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
- return false;
+ return sw::sidebarwindows::SIDEBAR_NONE;
else
{
const bool bLTR = GetUpper() ? static_cast<const SwRootFrm*>(GetUpper())->IsLeftToRightViewLayout() : true;
const bool bBookMode = GetShell()->GetViewOptions()->IsViewLayoutBookMode();
const bool bRightSidebar = bLTR ? (!bBookMode || OnRightPage()) : (bBookMode && !OnRightPage());
- return !bRightSidebar;
+ return bRightSidebar
+ ? sw::sidebarwindows::SIDEBAR_RIGHT
+ : sw::sidebarwindows::SIDEBAR_LEFT;
}
}
@@ -2310,7 +2312,7 @@ void SwRootFrm::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVi
const SwTwips nCurrentPageWidth = pFormatPage->Frm().Width() + (pFormatPage->IsEmptyPage() ? 0 : nSidebarWidth);
const Point aOldPagePos = pPageToAdjust->Frm().Pos();
- const bool bLeftSidebar = pPageToAdjust->MarginSide();
+ const bool bLeftSidebar = pPageToAdjust->SidebarPosition() == sw::sidebarwindows::SIDEBAR_LEFT;
const SwTwips nLeftPageAddOffset = bLeftSidebar ?
nSidebarWidth :
0;
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ee9671ac869f..09fc6b00e03d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2838,7 +2838,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con
// <--
{
const bool bPaintRightShadow = !bBookMode || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage());
- const bool bRightSidebar = !pPage->MarginSide();
+ const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
if ( !pPage->IsEmptyPage() )
{
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c3bccc695934..f912be5cb9b1 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4773,6 +4773,30 @@ void SwRowFrm::Cut()
{
pTab->FindMaster()->InvalidatePos();
}
+
+ // --> OD 2010-02-17 #i103961#
+ // notification for accessibility
+ {
+ SwRootFrm *pRootFrm = FindRootFrm();
+ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+ {
+ ViewShell* pVSh = pRootFrm->GetCurrShell();
+ if ( pVSh && pVSh->Imp() )
+ {
+ SwFrm* pCellFrm( GetLower() );
+ while ( pCellFrm )
+ {
+ ASSERT( pCellFrm->IsCellFrm(),
+ "<SwRowFrm::Cut()> - unexpected type of SwRowFrm lower." );
+ pVSh->Imp()->DisposeAccessibleFrm( pCellFrm );
+
+ pCellFrm = pCellFrm->GetNext();
+ }
+ }
+ }
+ }
+ // <--
+
SwLayoutFrm::Cut();
}
@@ -5652,15 +5676,25 @@ long SwCellFrm::GetLayoutRowSpan() const
return nRet;
}
-/*************************************************************************
-|*
-|* SwCellFrm::Modify()
-|*
-|* Ersterstellung MA 20. Dec. 96
-|* Letzte Aenderung MA 20. Dec. 96
-|*
-|*************************************************************************/
+// --> OD 2010-02-17 #i103961#
+void SwCellFrm::Cut()
+{
+ // notification for accessibility
+ {
+ SwRootFrm *pRootFrm = FindRootFrm();
+ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+ {
+ ViewShell* pVSh = pRootFrm->GetCurrShell();
+ if ( pVSh && pVSh->Imp() )
+ {
+ pVSh->Imp()->DisposeAccessibleFrm( this );
+ }
+ }
+ }
+ SwLayoutFrm::Cut();
+}
+// <--
//
// Helper functions for repeated headlines:
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 5aff2f71b0d5..ade3efd4e70d 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -768,28 +768,6 @@ void SwFrm::Remove()
{
ASSERT( pUpper, "Removen ohne Upper?" );
- // --> OD 2004-09-27 #114344# - inform accessibility API - dispose table the
- // frame is in - before frame is 'removed from the layout' and
- // only for cell frames and row frames.
- if ( IsInTab() && ( IsRowFrm() || IsCellFrm() ) )
- {
- SwTabFrm* pTableFrm = FindTabFrm();
- if( pTableFrm != NULL &&
- pTableFrm->IsAccessibleFrm() &&
- pTableFrm->GetFmt() != NULL )
- {
- SwRootFrm *pRootFrm = pTableFrm->FindRootFrm();
- if( pRootFrm != NULL &&
- pRootFrm->IsAnyShellAccessible() )
- {
- ViewShell* pShell = pRootFrm->GetCurrShell();
- if( pShell != NULL )
- pShell->Imp()->DisposeAccessibleFrm( pTableFrm, sal_True );
- }
- }
- }
- // <--
-
if( pPrev )
// einer aus der Mitte wird removed
pPrev->pNext = pNext;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 697e99c96299..09c13b8fb250 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1392,14 +1392,17 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
case POR_PARA :
{
SwTxtNode* pNd = (SwTxtNode*)pFrm->GetTxtNode();
- SwIndex aIndex( pNd, rInf.GetIdx() );
- const SwTxtAttr* pInetFmtAttr = pNd->GetTxtAttr( aIndex, RES_TXTATR_INETFMT );
+ SwTxtAttr const*const pInetFmtAttr =
+ pNd->GetTxtAttrAt(rInf.GetIdx(), RES_TXTATR_INETFMT);
String sStyleName;
if ( !pInetFmtAttr )
{
- const SwTxtAttr* pCharFmtAttr = pNd->GetTxtAttr( aIndex, RES_TXTATR_CHARFMT );
- const SwCharFmt* pCharFmt = pCharFmtAttr ? pCharFmtAttr->GetCharFmt().GetCharFmt() : 0;
+ ::std::vector<SwTxtAttr *> const charAttrs(
+ pNd->GetTxtAttrsAt(rInf.GetIdx(), RES_TXTATR_CHARFMT));
+ // TODO: handle more than 1 char style?
+ const SwCharFmt* pCharFmt = (charAttrs.size())
+ ? (*charAttrs.begin())->GetCharFmt().GetCharFmt() : 0;
if ( pCharFmt )
SwStyleNameMapper::FillProgName( pCharFmt->GetName(), sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
}
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 7687a71309ac..ffcf4b53afbd 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -77,7 +77,7 @@
#include <doc.hxx>
#include <pam.hxx>
#include <SwGrammarMarkUp.hxx>
-
+#include <cstdio>
// --> FME 2004-06-08 #i12836# enhanced pdf export
#include <EnhancedPDFExportHelper.hxx>
// <--
@@ -1325,8 +1325,8 @@ void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const
if( aIntersect.HasArea() )
{
SwTxtNode *pNd = (SwTxtNode*)GetTxtFrm()->GetTxtNode();
- SwIndex aIndex( pNd, GetIdx() );
- SwTxtAttr *pAttr = pNd->GetTxtAttr( aIndex, RES_TXTATR_INETFMT );
+ SwTxtAttr *const pAttr =
+ pNd->GetTxtAttrAt(GetIdx(), RES_TXTATR_INETFMT);
if( pAttr )
{
const SwFmtINetFmt& rFmt = pAttr->GetINetFmt();
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 6c48aeeb181d..db245de1e28b 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -2341,84 +2341,6 @@ SwRect SwTxtFly::AnchoredObjToRect( const SwAnchoredObject* pAnchoredObj,
// Beidseitiger Umfluss bis zu einer Rahmenbreite von maximal 1,5 cm
#define FRAME_MAX 850
-//_FlyCntnt SwTxtFly::CalcSmart( const SdrObject *pObj ) const
-//{
-// _FlyCntnt eOrder;
-
-// // 11839: Nur die X-Positionen sind interessant, die Y-Positionen des
-// // CurrentFrames koennen sich noch aendern (wachsen).
-
-// SWRECTFN( pCurrFrm )
-// const long nCurrLeft = (pCurrFrm->*fnRect->fnGetPrtLeft)();
-// const long nCurrRight = (pCurrFrm->*fnRect->fnGetPrtRight)();
-// const SwRect aRect( GetBoundRect( pObj ) );
-// long nFlyLeft = (aRect.*fnRect->fnGetLeft)();
-// long nFlyRight = (aRect.*fnRect->fnGetRight)();
-
-// if ( nFlyRight < nCurrLeft || nFlyLeft > nCurrRight )
-// eOrder = SURROUND_PARALLEL;
-// else
-// {
-// long nLeft = nFlyLeft - nCurrLeft;
-// long nRight = nCurrRight - nFlyRight;
-// if( nFlyRight - nFlyLeft > FRAME_MAX )
-// {
-// if( nLeft < nRight )
-// nLeft = 0;
-// else
-// nRight = 0;
-// }
-// if( nLeft < TEXT_MIN )
-// nLeft = 0;
-// if( nRight < TEXT_MIN )
-// nRight = 0;
-// if( nLeft )
-// eOrder = nRight ? SURROUND_PARALLEL : SURROUND_LEFT;
-// else
-// eOrder = nRight ? SURROUND_RIGHT: SURROUND_NONE;
-// }
-
-// return eOrder;
-//}
-
-/*************************************************************************
- * SwTxtFly::GetOrder()
- *************************************************************************/
-
-//_FlyCntnt SwTxtFly::GetOrder( const SdrObject *pObj ) const
-//{
-// const SwFrmFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
-// const SwFmtSurround &rFlyFmt = pFmt->GetSurround();
-// _FlyCntnt eOrder = rFlyFmt.GetSurround();
-
-// if( rFlyFmt.IsAnchorOnly() && &lcl_TheAnchor( pObj ) != GetMaster() )
-// {
-// const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
-// if( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
-// FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
-// return SURROUND_NONE;
-// }
-
-// Beim Durchlauf und Nowrap wird smart ignoriert.
-// if( SURROUND_THROUGHT == eOrder || SURROUND_NONE == eOrder )
-// return eOrder;
-
-// left is left and right is right
-// if ( pCurrFrm->IsRightToLeft() )
-// {
-// if ( SURROUND_LEFT == eOrder )
-// eOrder = SURROUND_RIGHT;
-// else if ( SURROUND_RIGHT == eOrder )
-// eOrder = SURROUND_LEFT;
-// }
-
-// "idealer Seitenumlauf":
-// if( SURROUND_IDEAL == eOrder )
-// eOrder = CalcSmart( pObj ); //Bei SMART wird die Order automatisch berechnet:
-
-// return eOrder;
-//}
-
SwSurround SwTxtFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredObj ) const
{
const SwFrmFmt* pFmt = &(pAnchoredObj->GetFrmFmt());
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 16fbc589c16d..0861f98b2ddf 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1026,6 +1026,13 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
SET_SCRIPT_INVAL( nPos )
}
}
+
+ // --> OD 2010-02-16 #i104008#
+ if ( GetShell() )
+ {
+ GetShell()->InvalidateAccessibleParaAttrs( *this );
+ }
+ // <--
}
break;
case RES_OBJECTDYING:
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index d6770321768f..798d7e41602f 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1196,60 +1196,109 @@ BOOL SwTxtNode::DontExpandFmt( const SwIndex& rIdx, bool bFlag,
return bRet;
}
+static bool lcl_GetTxtAttrDefault(xub_StrLen const nIndex,
+ xub_StrLen const nHintStart, xub_StrLen const nHintEnd)
+{
+ return ((nHintStart <= nIndex) && (nIndex < nHintEnd));
+}
+static bool lcl_GetTxtAttrExpand(xub_StrLen const nIndex,
+ xub_StrLen const nHintStart, xub_StrLen const nHintEnd)
+{
+ return ((nHintStart < nIndex) && (nIndex <= nHintEnd));
+}
+static bool lcl_GetTxtAttrParent(xub_StrLen const nIndex,
+ xub_StrLen const nHintStart, xub_StrLen const nHintEnd)
+{
+ return ((nHintStart < nIndex) && (nIndex < nHintEnd));
+}
-// gebe das vorgegebene Attribut, welches an der TextPosition (rIdx)
-// gesetzt ist, zurueck. Gibt es keines, returne 0-Pointer.
-// (gesetzt heisst, je nach bExpand ?
-// Start < rIdx <= End
-// : Start <= rIdx < End )
-
-SwTxtAttr* SwTxtNode::GetTxtAttr( const SwIndex& rIdx, USHORT nWhichHt,
- BOOL bExpand ) const
+static void
+lcl_GetTxtAttrs(
+ ::std::vector<SwTxtAttr *> *const pVector, SwTxtAttr **const ppTxtAttr,
+ SwpHints *const pSwpHints,
+ xub_StrLen const nIndex, RES_TXTATR const nWhich,
+ enum SwTxtNode::GetTxtAttrMode const eMode)
{
- const SwTxtAttr* pRet = 0;
- const SwTxtAttr* pHt = 0;
- const xub_StrLen *pEndIdx = 0;
- const xub_StrLen nIdx = rIdx.GetIndex();
- const USHORT nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
+ USHORT const nSize = (pSwpHints) ? pSwpHints->Count() : 0;
+ xub_StrLen nPreviousIndex(0); // index of last hint with nWhich
+ bool (*pMatchFunc)(xub_StrLen const, xub_StrLen const, xub_StrLen const)=0;
+ switch (eMode)
+ {
+ case SwTxtNode::DEFAULT: pMatchFunc = &lcl_GetTxtAttrDefault; break;
+ case SwTxtNode::EXPAND: pMatchFunc = &lcl_GetTxtAttrExpand; break;
+ case SwTxtNode::PARENT: pMatchFunc = &lcl_GetTxtAttrParent; break;
+ default: OSL_ASSERT(false);
+ }
for( USHORT i = 0; i < nSize; ++i )
{
- // ist der Attribut-Anfang schon groesser als der Idx ?
- pHt = (*m_pSwpHints)[i];
- if ( nIdx < *(pHt->GetStart()) )
- break; // beenden, kein gueltiges Attribut
-
- // ist es das gewuenschte Attribut ?
- if( pHt->Which() != nWhichHt )
- continue; // nein, weiter
-
- pEndIdx = pHt->GetEnd();
- // liegt innerhalb des Bereiches ??
- if( !pEndIdx )
+ SwTxtAttr *const pHint = pSwpHints->GetTextHint(i);
+ xub_StrLen const nHintStart( *(pHint->GetStart()) );
+ if (nIndex < nHintStart)
{
- if( *pHt->GetStart() == nIdx )
- {
- pRet = pHt;
- break;
- }
+ return; // hints are sorted by start, so we are done...
}
- else if( *pHt->GetStart() <= nIdx && nIdx <= *pEndIdx )
+
+ if (pHint->Which() != nWhich)
{
+ continue;
+ }
+
+ xub_StrLen const*const pEndIdx = pHint->GetEnd();
+ ASSERT(pEndIdx || pHint->HasDummyChar(),
+ "hint with no end and no dummy char?");
// Wenn bExpand gesetzt ist, wird das Verhalten bei Eingabe
// simuliert, d.h. der Start wuede verschoben, das Ende expandiert,
- if( bExpand )
+ bool const bContained( (pEndIdx)
+ ? (*pMatchFunc)(nIndex, nHintStart, *pEndIdx)
+ : (nHintStart == nIndex) );
+ if (bContained)
+ {
+ if (pVector)
{
- if( *pHt->GetStart() < nIdx )
- pRet = pHt;
+ if (nPreviousIndex < nHintStart)
+ {
+ pVector->clear(); // clear hints that are outside pHint
+ nPreviousIndex = nHintStart;
+ }
+ pVector->push_back(pHint);
}
else
{
- if( nIdx < *pEndIdx )
- pRet = pHt; // den am dichtesten liegenden
+ *ppTxtAttr = pHint; // and possibly overwrite outer hint
+ }
+ if (!pEndIdx)
+ {
+ break;
}
}
}
- return (SwTxtAttr*)pRet; // kein gueltiges Attribut gefunden !!
+}
+
+::std::vector<SwTxtAttr *>
+SwTxtNode::GetTxtAttrsAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode) const
+{
+ ::std::vector<SwTxtAttr *> ret;
+ lcl_GetTxtAttrs(& ret, 0, m_pSwpHints, nIndex, nWhich, eMode);
+ return ret;
+}
+
+SwTxtAttr *
+SwTxtNode::GetTxtAttrAt(xub_StrLen const nIndex, RES_TXTATR const nWhich,
+ enum GetTxtAttrMode const eMode) const
+{
+ ASSERT( (nWhich == RES_TXTATR_META)
+ || (nWhich == RES_TXTATR_METAFIELD)
+ || (nWhich == RES_TXTATR_AUTOFMT)
+ || (nWhich == RES_TXTATR_INETFMT)
+ || (nWhich == RES_TXTATR_CJK_RUBY)
+ || (nWhich == RES_TXTATR_UNKNOWN_CONTAINER),
+ "GetTxtAttrAt() will give wrong result for this hint!");
+
+ SwTxtAttr * pRet(0);
+ lcl_GetTxtAttrs(0, & pRet, m_pSwpHints, nIndex, nWhich, eMode);
+ return pRet;
}
/*************************************************************************
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index aae0b8de10ac..6df9f9aa24b8 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -614,9 +614,8 @@ SwHistoryBookmark::SwHistoryBookmark(
m_aKeycode = pBookmark->GetKeyCode();
m_aShortName = pBookmark->GetShortName();
- ::sfx2::Metadatable * const pMetadatable(
- const_cast< ::sfx2::Metadatable * >( // CreateUndo should be const?
- dynamic_cast< ::sfx2::Metadatable const* >(pBookmark)));
+ ::sfx2::Metadatable const*const pMetadatable(
+ dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
if (pMetadatable)
{
m_pMetadataUndo = pMetadatable->CreateUndo();
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index dd44a981d1d4..e3b54c59b142 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -1055,8 +1055,8 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
SwTxtNode* pTxtNd = rNds[ nNode ]->GetTxtNode();
if( pTxtNd )
{
- SwIndex aIdx( pTxtNd, nCntnt );
- SwTxtAttr * pTxtHt = pTxtNd->GetTxtAttr( aIdx, RES_TXTATR_FTN );
+ SwTxtAttr *const pTxtHt =
+ pTxtNd->GetTxtAttrForCharAt(nCntnt, RES_TXTATR_FTN);
if( pTxtHt )
{
// ok, dann hole mal die Werte
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 593382fd999e..347a70190006 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -391,7 +391,9 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
bool emptied( pSttStr->Len() && !pSttTxtNd->Len() );
if (!bOneNode || emptied) // merging may overwrite xmlids...
{
- m_pMetadataUndoStart = pSttTxtNd->CreateUndo( emptied );
+ m_pMetadataUndoStart = (emptied)
+ ? pSttTxtNd->CreateUndoForDelete()
+ : pSttTxtNd->CreateUndo();
}
if( bOneNode )
@@ -425,7 +427,10 @@ BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
// METADATA: store
bool emptied( pEndStr->Len() && !pEndTxtNd->Len() );
- m_pMetadataUndoEnd = pEndTxtNd->CreateUndo( emptied );
+
+ m_pMetadataUndoEnd = (emptied)
+ ? pEndTxtNd->CreateUndoForDelete()
+ : pEndTxtNd->CreateUndo();
}
// sind es nur zwei Nodes, dann ist schon alles erledigt.
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 9f5687a8edce..98d0e41d4616 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -74,34 +74,31 @@ SfxItemSet* lcl_GetAttrSet( const SwSection& rSect )
return pAttr;
}
-SwUndoInsSection::SwUndoInsSection( const SwPaM& rPam, const SwSection& rNew,
- const SfxItemSet* pSet )
- : SwUndo( UNDO_INSSECTION ), SwUndRng( rPam ),
- pHistory( 0 ), pRedlData( 0 ), pAttr( 0 ), nSectNodePos( 0 )
-{
- if( rNew.ISA( SwTOXBaseSection ))
- {
- const SwTOXBase& rBase = (SwTOXBaseSection&)rNew;
- pSection = new SwTOXBaseSection( rBase );
- }
- else
- pSection = new SwSection( rNew.GetType(), rNew.GetName() );
- *pSection = rNew;
+////////////////////////////////////////////////////////////////////////////
+
+SwUndoInsSection::SwUndoInsSection(
+ SwPaM const& rPam, SwSectionData const& rNewData,
+ SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase)
+ : SwUndo( UNDO_INSSECTION ), SwUndRng( rPam )
+ , m_pSectionData(new SwSectionData(rNewData))
+ , m_pTOXBase( (pTOXBase) ? new SwTOXBase(*pTOXBase) : 0 )
+ , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : 0 )
+ , m_pHistory(0)
+ , m_pRedlData(0)
+ , m_nSectionNodePos(0)
+ , m_bSplitAtStart(false)
+ , m_bSplitAtEnd(false)
+ , m_bUpdateFtn(false)
+{
SwDoc& rDoc = *(SwDoc*)rPam.GetDoc();
if( rDoc.IsRedlineOn() )
{
- pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT,
- rDoc.GetRedlineAuthor() );
+ m_pRedlData.reset(new SwRedlineData( nsRedlineType_t::REDLINE_INSERT,
+ rDoc.GetRedlineAuthor() ));
SetRedlineMode( rDoc.GetRedlineMode() );
}
- bSplitAtStt = FALSE;
- bSplitAtEnd = FALSE;
- bUpdateFtn = FALSE;
-
- if( pSet && pSet->Count() )
- pAttr = new SfxItemSet( *pSet );
if( !rPam.HasMark() )
{
@@ -114,33 +111,25 @@ SwUndoInsSection::SwUndoInsSection( const SwPaM& rPam, const SwSection& rNew,
aBrkSet.Put( *pCNd->GetpSwAttrSet() );
if( aBrkSet.Count() )
{
- pHistory = new SwHistory;
- pHistory->CopyFmtAttr( aBrkSet, pCNd->GetIndex() );
+ m_pHistory.reset( new SwHistory );
+ m_pHistory->CopyFmtAttr( aBrkSet, pCNd->GetIndex() );
}
}
}
}
-
SwUndoInsSection::~SwUndoInsSection()
{
- delete pSection;
- delete pRedlData;
- delete pAttr;
-
- if( pHistory )
- delete pHistory;
}
-
-
void SwUndoInsSection::Undo( SwUndoIter& rUndoIter )
{
SwDoc& rDoc = rUndoIter.GetDoc();
- RemoveIdxFromSection( rDoc, nSectNodePos );
+ RemoveIdxFromSection( rDoc, m_nSectionNodePos );
- SwSectionNode* pNd = rDoc.GetNodes()[ nSectNodePos ]->GetSectionNode();
+ SwSectionNode *const pNd =
+ rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
ASSERT( pNd, "wo ist mein SectionNode?" );
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
@@ -158,19 +147,25 @@ void SwUndoInsSection::Undo( SwUndoIter& rUndoIter )
rDoc.DelSectionFmt( pNd->GetSection().GetFmt() );
// muessen wir noch zusammenfassen ?
- if( bSplitAtStt )
+ if (m_bSplitAtStart)
+ {
Join( rDoc, nSttNode );
+ }
- if( bSplitAtEnd )
+ if (m_bSplitAtEnd)
+ {
Join( rDoc, nEndNode );
+ }
- if ( pHistory )
+ if (m_pHistory.get())
{
- pHistory->TmpRollback( &rDoc, 0, false );
+ m_pHistory->TmpRollback( &rDoc, 0, false );
}
- if( bUpdateFtn )
+ if (m_bUpdateFtn)
+ {
rDoc.GetFtnIdxs().UpdateFtn( aIdx );
+ }
SetPaM( rUndoIter );
}
@@ -182,28 +177,32 @@ void SwUndoInsSection::Redo( SwUndoIter& rUndoIter )
SetPaM( rUndoIter );
const SwTOXBaseSection* pUpdateTOX = 0;
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
pUpdateTOX = rDoc.InsertTableOf( *rUndoIter.pAktPam->GetPoint(),
- rBase, pAttr, TRUE );
+ *m_pTOXBase, m_pAttrSet.get(), true);
}
else
{
- rDoc.InsertSwSection( *rUndoIter.pAktPam, *pSection, pAttr, true );
+ rDoc.InsertSwSection(*rUndoIter.pAktPam,
+ *m_pSectionData, 0, m_pAttrSet.get(), true);
}
- if( pHistory )
- pHistory->SetTmpEnd( pHistory->Count() );
+ if (m_pHistory.get())
+ {
+ m_pHistory->SetTmpEnd( m_pHistory->Count() );
+ }
- SwSectionNode* pSectNd = rDoc.GetNodes()[ nSectNodePos ]->GetSectionNode();
- if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
+ SwSectionNode *const pSectNd =
+ rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
+ if (m_pRedlData.get() &&
+ IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode()))
{
RedlineMode_t eOld = rDoc.GetRedlineMode();
rDoc.SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
- rDoc.AppendRedline( new SwRedline( *pRedlData, aPam ), true);
+ rDoc.AppendRedline( new SwRedline( *m_pRedlData, aPam ), true);
rDoc.SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
@@ -228,16 +227,15 @@ void SwUndoInsSection::Redo( SwUndoIter& rUndoIter )
void SwUndoInsSection::Repeat( SwUndoIter& rUndoIter )
{
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
rUndoIter.GetDoc().InsertTableOf( *rUndoIter.pAktPam->GetPoint(),
- rBase, pAttr, TRUE );
+ *m_pTOXBase, m_pAttrSet.get(), true);
}
else
{
rUndoIter.GetDoc().InsertSwSection( *rUndoIter.pAktPam,
- *pSection, pAttr );
+ *m_pSectionData, 0, m_pAttrSet.get());
}
}
@@ -254,7 +252,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, ULONG nNode )
}
pTxtNd->JoinNext();
- if( pHistory )
+ if (m_pHistory.get())
{
SwIndex aCntIdx( pTxtNd, 0 );
pTxtNd->RstAttr( aCntIdx, pTxtNd->Len(), 0, 0, true );
@@ -262,74 +260,99 @@ void SwUndoInsSection::Join( SwDoc& rDoc, ULONG nNode )
}
-void SwUndoInsSection::SaveSplitNode( SwTxtNode* pTxtNd, BOOL bAtStt )
+void
+SwUndoInsSection::SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart)
{
if( pTxtNd->GetpSwpHints() )
{
- if( !pHistory )
- pHistory = new SwHistory;
- pHistory->CopyAttr( pTxtNd->GetpSwpHints(), pTxtNd->GetIndex(), 0,
+ if (!m_pHistory.get())
+ {
+ m_pHistory.reset( new SwHistory );
+ }
+ m_pHistory->CopyAttr( pTxtNd->GetpSwpHints(), pTxtNd->GetIndex(), 0,
pTxtNd->GetTxt().Len(), false );
}
- if( bAtStt )
- bSplitAtStt = TRUE;
+ if (bAtStart)
+ {
+ m_bSplitAtStart = true;
+ }
else
- bSplitAtEnd = TRUE;
+ {
+ m_bSplitAtEnd = true;
+ }
}
-// -----------------------------
+////////////////////////////////////////////////////////////////////////////
-SwUndoDelSection::SwUndoDelSection( const SwSectionFmt& rFmt )
- : SwUndo( UNDO_DELSECTION )
+class SwUndoDelSection
+ : public SwUndo
{
- const SwSection& rSect = *rFmt.GetSection();
- if( rSect.ISA( SwTOXBaseSection ))
- {
- const SwTOXBase& rBase = (SwTOXBaseSection&)rSect;
- pSection = new SwTOXBaseSection( rBase );
- }
- else
- pSection = new SwSection( rSect.GetType(), rSect.GetName() );
- *pSection = rSect;
-
- pAttr = ::lcl_GetAttrSet( rSect );
-
- const SwNodeIndex* pIdx = rFmt.GetCntnt().GetCntntIdx();
- nSttNd = pIdx->GetIndex();
- nEndNd = pIdx->GetNode().EndOfSectionIndex();
+private:
+ ::std::auto_ptr<SwSectionData> const m_pSectionData; /// section not TOX
+ ::std::auto_ptr<SwTOXBase> const m_pTOXBase; /// set iff section is TOX
+ ::std::auto_ptr<SfxItemSet> const m_pAttrSet;
+ ::boost::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
+ ULONG const m_nStartNode;
+ ULONG const m_nEndNode;
+
+public:
+ SwUndoDelSection(
+ SwSectionFmt const&, SwSection const&, SwNodeIndex const*const);
+ virtual ~SwUndoDelSection();
+ virtual void Undo( SwUndoIter& );
+ virtual void Redo( SwUndoIter& );
+};
+
+SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const& rFormat)
+{
+ return new SwUndoDelSection(rFormat, *rFormat.GetSection(),
+ rFormat.GetCntnt().GetCntntIdx());
}
+SwUndoDelSection::SwUndoDelSection(
+ SwSectionFmt const& rSectionFmt, SwSection const& rSection,
+ SwNodeIndex const*const pIndex)
+ : SwUndo( UNDO_DELSECTION )
+ , m_pSectionData( new SwSectionData(rSection) )
+ , m_pTOXBase( rSection.ISA( SwTOXBaseSection )
+ ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
+ : 0 )
+ , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
+ , m_pMetadataUndo( rSectionFmt.CreateUndo() )
+ , m_nStartNode( pIndex->GetIndex() )
+ , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
+{
+}
SwUndoDelSection::~SwUndoDelSection()
{
- delete pSection;
- delete pAttr;
}
-
void SwUndoDelSection::Undo( SwUndoIter& rUndoIter )
{
SwDoc& rDoc = rUndoIter.GetDoc();
- if( pSection->ISA( SwTOXBaseSection ))
+ if (m_pTOXBase.get())
{
- const SwTOXBase& rBase = *(SwTOXBaseSection*)pSection;
- rDoc.InsertTableOf( nSttNd, nEndNd-2, rBase, pAttr );
+ rDoc.InsertTableOf(m_nStartNode, m_nEndNode-2, *m_pTOXBase,
+ m_pAttrSet.get());
}
else
{
- SwNodeIndex aStt( rDoc.GetNodes(), nSttNd );
- SwNodeIndex aEnd( rDoc.GetNodes(), nEndNd-2 );
+ SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
+ SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
SwSectionFmt* pFmt = rDoc.MakeSectionFmt( 0 );
- if( pAttr )
- pFmt->SetFmtAttr( *pAttr );
+ if (m_pAttrSet.get())
+ {
+ pFmt->SetFmtAttr( *m_pAttrSet );
+ }
/// OD 04.10.2002 #102894#
/// remember inserted section node for further calculations
- SwSectionNode* pInsertedSectNd =
- rDoc.GetNodes().InsertSection( aStt, *pFmt, *pSection, &aEnd );
+ SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
+ aStt, *pFmt, *m_pSectionData, 0, & aEnd);
if( SFX_ITEM_SET == pFmt->GetItemState( RES_FTN_AT_TXTEND ) ||
SFX_ITEM_SET == pFmt->GetItemState( RES_END_AT_TXTEND ))
@@ -356,63 +379,86 @@ void SwUndoDelSection::Undo( SwUndoIter& rUndoIter )
aInsertedSect.SetCondHidden( bRecalcCondHidden );
}
+ pFmt->RestoreMetadata(m_pMetadataUndo);
}
}
-
void SwUndoDelSection::Redo( SwUndoIter& rUndoIter )
{
SwDoc& rDoc = rUndoIter.GetDoc();
- SwSectionNode* pNd = rDoc.GetNodes()[ nSttNd ]->GetSectionNode();
+ SwSectionNode *const pNd =
+ rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
ASSERT( pNd, "wo ist mein SectionNode?" );
// einfach das Format loeschen, der Rest erfolgt automatisch
rDoc.DelSectionFmt( pNd->GetSection().GetFmt() );
}
+////////////////////////////////////////////////////////////////////////////
-SwUndoChgSection::SwUndoChgSection( const SwSectionFmt& rFmt, BOOL bOnlyAttr )
- : SwUndo( UNDO_CHGSECTION ), bOnlyAttrChgd( bOnlyAttr )
+class SwUndoUpdateSection
+ : public SwUndo
{
- const SwSection& rSect = *rFmt.GetSection();
- pSection = new SwSection( rSect.GetType(), rSect.GetName() );
- *pSection = rSect;
-
- pAttr = ::lcl_GetAttrSet( rSect );
-
- nSttNd = rFmt.GetCntnt().GetCntntIdx()->GetIndex();
+private:
+ ::std::auto_ptr<SwSectionData> m_pSectionData;
+ ::std::auto_ptr<SfxItemSet> m_pAttrSet;
+ ULONG const m_nStartNode;
+ bool const m_bOnlyAttrChanged;
+
+public:
+ SwUndoUpdateSection(
+ SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
+ virtual ~SwUndoUpdateSection();
+ virtual void Undo( SwUndoIter& );
+ virtual void Redo( SwUndoIter& );
+};
+
+SW_DLLPRIVATE SwUndo *
+MakeUndoUpdateSection(SwSectionFmt const& rFormat, bool const bOnlyAttr)
+{
+ return new SwUndoUpdateSection(*rFormat.GetSection(),
+ rFormat.GetCntnt().GetCntntIdx(), bOnlyAttr);
}
-
-SwUndoChgSection::~SwUndoChgSection()
+SwUndoUpdateSection::SwUndoUpdateSection(
+ SwSection const& rSection, SwNodeIndex const*const pIndex,
+ bool const bOnlyAttr)
+ : SwUndo( UNDO_CHGSECTION )
+ , m_pSectionData( new SwSectionData(rSection) )
+ , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
+ , m_nStartNode( pIndex->GetIndex() )
+ , m_bOnlyAttrChanged( bOnlyAttr )
{
- delete pSection;
- delete pAttr;
}
+SwUndoUpdateSection::~SwUndoUpdateSection()
+{
+}
-void SwUndoChgSection::Undo( SwUndoIter& rUndoIter )
+void SwUndoUpdateSection::Undo( SwUndoIter& rUndoIter )
{
SwDoc& rDoc = rUndoIter.GetDoc();
- SwSectionNode* pSectNd = rDoc.GetNodes()[ nSttNd ]->GetSectionNode();
+ SwSectionNode *const pSectNd =
+ rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
ASSERT( pSectNd, "wo ist mein SectionNode?" );
SwSection& rNdSect = pSectNd->GetSection();
SwFmt* pFmt = rNdSect.GetFmt();
SfxItemSet* pCur = ::lcl_GetAttrSet( rNdSect );
- if( pAttr )
+ if (m_pAttrSet.get())
{
// das Content- und Protect-Item muss bestehen bleiben
const SfxPoolItem* pItem;
- pAttr->Put( pFmt->GetFmtAttr( RES_CNTNT ));
+ m_pAttrSet->Put( pFmt->GetFmtAttr( RES_CNTNT ));
if( SFX_ITEM_SET == pFmt->GetItemState( RES_PROTECT, TRUE, &pItem ))
- pAttr->Put( *pItem );
- pFmt->DelDiffs( *pAttr );
- pAttr->ClearItem( RES_CNTNT );
- pFmt->SetFmtAttr( *pAttr );
- delete pAttr;
+ {
+ m_pAttrSet->Put( *pItem );
+ }
+ pFmt->DelDiffs( *m_pAttrSet );
+ m_pAttrSet->ClearItem( RES_CNTNT );
+ pFmt->SetFmtAttr( *m_pAttrSet );
}
else
{
@@ -421,22 +467,20 @@ void SwUndoChgSection::Undo( SwUndoIter& rUndoIter )
pFmt->ResetFmtAttr( RES_HEADER, RES_OPAQUE );
pFmt->ResetFmtAttr( RES_SURROUND, RES_FRMATR_END-1 );
}
- pAttr = pCur;
+ m_pAttrSet.reset(pCur);
- if( !bOnlyAttrChgd )
+ if (!m_bOnlyAttrChanged)
{
- BOOL bUpdate = (!rNdSect.IsLinkType() && pSection->IsLinkType() ) ||
- ( pSection->GetLinkFileName().Len() &&
- pSection->GetLinkFileName() !=
- rNdSect.GetLinkFileName());
-
- SwSection* pTmp = new SwSection( CONTENT_SECTION, aEmptyStr );
- *pTmp = rNdSect; // das aktuelle sichern
+ const bool bUpdate =
+ (!rNdSect.IsLinkType() && m_pSectionData->IsLinkType())
+ || ( m_pSectionData->GetLinkFileName().Len()
+ && (m_pSectionData->GetLinkFileName() !=
+ rNdSect.GetLinkFileName()));
- rNdSect = *pSection; // das alte setzen
-
- delete pSection;
- pSection = pTmp; // das aktuelle ist jetzt das alte
+ // swap stored section data with live section data
+ SwSectionData *const pOld( new SwSectionData(rNdSect) );
+ rNdSect.SetSectionData(*m_pSectionData);
+ m_pSectionData.reset(pOld);
if( bUpdate )
rNdSect.CreateLink( CREATE_UPDATE );
@@ -448,8 +492,8 @@ void SwUndoChgSection::Undo( SwUndoIter& rUndoIter )
}
}
-
-void SwUndoChgSection::Redo( SwUndoIter& rUndoIter )
+void SwUndoUpdateSection::Redo( SwUndoIter& rUndoIter )
{
Undo( rUndoIter );
}
+
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index efe1aae42569..0b8f938d307d 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1363,7 +1363,8 @@ uno::Any SwXTextSections::getByName(const OUString& Name)
for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
SwSectionFmt* pFmt = rFmts[i];
- if(pFmt->IsInNodesArr() && aName == pFmt->GetSection()->GetName())
+ if (pFmt->IsInNodesArr()
+ && (aName == pFmt->GetSection()->GetSectionName()))
{
xSect = GetObject(*pFmt);
aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
@@ -1407,7 +1408,7 @@ uno::Sequence< OUString > SwXTextSections::getElementNames(void)
{
pFmt = rFmts[++nIndex];
}
- pArray[i] = pFmt->GetSection()->GetName();
+ pArray[i] = pFmt->GetSection()->GetSectionName();
}
}
return aSeq;
@@ -1427,7 +1428,7 @@ sal_Bool SwXTextSections::hasByName(const OUString& Name)
for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
const SwSectionFmt* pFmt = rFmts[i];
- if(aName == pFmt->GetSection()->GetName())
+ if (aName == pFmt->GetSection()->GetSectionName())
{
bRet = sal_True;
break;
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index b9fe5556744c..92a33da130fe 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -88,6 +88,8 @@
// --> OD 2008-11-26 #158694#
#include <SwNodeNum.hxx>
// <--
+#include <fmtmeta.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -102,6 +104,37 @@ using ::rtl::OUString;
namespace SwUnoCursorHelper
{
+uno::Reference<text::XTextContent>
+GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
+ bool const bParent)
+{
+ // these should be unambiguous because of the dummy character
+ SwTxtNode::GetTxtAttrMode const eMode( (bParent)
+ ? SwTxtNode::PARENT : SwTxtNode::EXPAND );
+ SwTxtAttr *const pMetaTxtAttr =
+ rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_META, eMode);
+ SwTxtAttr *const pMetaFieldTxtAttr =
+ rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
+ // which is innermost?
+ SwTxtAttr *const pTxtAttr = (pMetaTxtAttr)
+ ? ((pMetaFieldTxtAttr)
+ ? ((*pMetaFieldTxtAttr->GetStart() >
+ *pMetaTxtAttr->GetStart())
+ ? pMetaFieldTxtAttr : pMetaTxtAttr)
+ : pMetaTxtAttr)
+ : pMetaFieldTxtAttr;
+ uno::Reference<XTextContent> xRet;
+ if (pTxtAttr)
+ {
+ ::sw::Meta *const pMeta(
+ static_cast<SwFmtMeta &>(pTxtAttr->GetAttr()).GetMeta());
+ OSL_ASSERT(pMeta);
+ xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
+ }
+ return xRet;
+}
+
+
/* -----------------16.09.98 12:27-------------------
* Lesen spezieller Properties am Cursor
* --------------------------------------------------*/
@@ -300,14 +333,15 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
break;
case FN_UNO_DOCUMENT_INDEX_MARK:
{
- SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
- rPam.GetPoint()->nContent, RES_TXTATR_TOXMARK);
- if(pTxtAttr)
+ ::std::vector<SwTxtAttr *> const marks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ if (marks.size())
{
if( pAny )
- {
+ { // hmm... can only return 1 here
SwTOXMark & rMark =
- static_cast<SwTOXMark&>(pTxtAttr->GetAttr());
+ static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
const uno::Reference< text::XDocumentIndexMark > xRef =
SwXDocumentIndexMark::CreateXDocumentIndexMark(
*rPam.GetDoc(),
@@ -343,9 +377,10 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
const SwPosition *pPos = rPam.Start();
const SwTxtNode *pTxtNd =
rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
- SwTxtAttr* pTxtAttr =
- pTxtNd ? pTxtNd->GetTxtAttr(pPos->nContent, RES_TXTATR_FIELD)
- : 0;
+ SwTxtAttr *const pTxtAttr = (pTxtNd)
+ ? pTxtNd->GetTxtAttrForCharAt(
+ pPos->nContent.GetIndex(), RES_TXTATR_FIELD)
+ : 0;
if(pTxtAttr)
{
if( pAny )
@@ -434,8 +469,9 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
case FN_UNO_ENDNOTE:
case FN_UNO_FOOTNOTE:
{
- SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->
- GetTxtAttr(rPam.GetPoint()->nContent, RES_TXTATR_FTN);
+ SwTxtAttr *const pTxtAttr =
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
if(pTxtAttr)
{
const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
@@ -457,13 +493,14 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
break;
case FN_UNO_REFERENCE_MARK:
{
- SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->
- GetTxtAttr(rPam.GetPoint()->nContent, RES_TXTATR_REFMARK);
- if(pTxtAttr)
+ ::std::vector<SwTxtAttr *> const marks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
+ if (marks.size())
{
if( pAny )
- {
- const SwFmtRefMark& rRef = pTxtAttr->GetRefMark();
+ { // hmm... can only return 1 here
+ const SwFmtRefMark& rRef = (*marks.begin())->GetRefMark();
uno::Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( rPam.GetDoc(), &rRef );
pAny->setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
}
@@ -472,6 +509,24 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
eNewState = PropertyState_DEFAULT_VALUE;
}
break;
+ case FN_UNO_NESTED_TEXT_CONTENT:
+ {
+ uno::Reference<XTextContent> const xRet(
+ GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
+ rPam.GetPoint()->nContent.GetIndex(), false));
+ if (xRet.is())
+ {
+ if (pAny)
+ {
+ (*pAny) <<= xRet;
+ }
+ }
+ else
+ {
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ break;
case FN_UNO_CHARFMT_SEQUENCE:
{
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 8749e9efb80a..d51225f84f96 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -915,9 +915,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
const SwSectionFmt* pTmpFmt = rSects[ i ];
if (pTmpFmt == pSectionFmt)
{
- m_pImpl->m_pDoc->ChgSection( i,
- static_cast<SwTOXBaseSection&>(rTOXBase),
- & aAttrSet);
+ SwSectionData tmpData(
+ static_cast<SwTOXBaseSection&>(rTOXBase));
+ m_pImpl->m_pDoc->UpdateSection(i, tmpData, & aAttrSet);
break;
}
}
@@ -1510,7 +1510,7 @@ OUString SAL_CALL SwXDocumentIndex::getName() throw (uno::RuntimeException)
}
else if(pSectionFmt)
{
- uRet = OUString(pSectionFmt->GetSection()->GetName());
+ uRet = OUString(pSectionFmt->GetSection()->GetSectionName());
}
else
{
@@ -1551,6 +1551,25 @@ SwXDocumentIndex::setName(const OUString& rName) throw (uno::RuntimeException)
}
}
+// MetadatableMixin
+::sfx2::Metadatable* SwXDocumentIndex::GetCoreObject()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ return pSectionFmt;
+}
+
+uno::Reference<frame::XModel> SwXDocumentIndex::GetModel()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (pSectionFmt)
+ {
+ SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
+
/******************************************************************
* SwXDocumentIndexMark
******************************************************************/
@@ -1573,6 +1592,8 @@ lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
class SwXDocumentIndexMark::Impl
: public SwClient
{
+private:
+ bool m_bInReplaceMark;
public:
@@ -1599,6 +1620,7 @@ public:
const enum TOXTypes eType,
SwTOXType *const pType, SwTOXMark const*const pMark)
: SwClient(const_cast<SwTOXMark*>(pMark))
+ , m_bInReplaceMark(false)
, m_rPropSet(
*aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType)))
, m_eTOXType(eType)
@@ -1617,11 +1639,33 @@ public:
const_cast<SwModify *>(m_TypeDepend.GetRegisteredIn()));
}
+ void DeleteTOXMark()
+ {
+ m_pDoc->DeleteTOXMark(m_pTOXMark); // calls Invalidate() via Modify!
+ m_pTOXMark = 0;
+ }
+
+ void InsertTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+ SwXTextCursor const*const pTextCursor);
+
+ void ReplaceTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam)
+ {
+ m_bInReplaceMark = true;
+ DeleteTOXMark();
+ m_bInReplaceMark = false;
+ try {
+ InsertTOXMark(rTOXType, rMark, rPam, 0);
+ } catch (...) {
+ OSL_ENSURE(false, "ReplaceTOXMark() failed!");
+ m_ListenerContainer.Disposing();
+ throw;
+ }
+ }
+
void Invalidate();
// SwClient
virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew);
-
};
/* -----------------------------16.10.00 11:24--------------------------------
@@ -1638,7 +1682,10 @@ void SwXDocumentIndexMark::Impl::Invalidate()
&m_TypeDepend);
}
}
- m_ListenerContainer.Disposing();
+ if (!m_bInReplaceMark) // #i109983# only dispose on delete, not on replace!
+ {
+ m_ListenerContainer.Disposing();
+ }
m_pDoc = 0;
m_pTOXMark = 0;
}
@@ -1831,32 +1878,7 @@ throw (uno::RuntimeException)
else
aPam.GetPoint()->nContent++;
- // delete old mark
- m_pImpl->m_pDoc->DeleteTOXMark(m_pImpl->m_pTOXMark);
- m_pImpl->m_pTOXMark = 0;
-
- SwTxtAttr* pTxtAttr = 0;
- sal_Bool bInsAtPos = aMark.IsAlternativeText();
- const SwPosition *pStt = aPam.Start(),
- *pEnd = aPam.End();
- if( bInsAtPos )
- {
- SwPaM aTmp( *pStt );
- m_pImpl->m_pDoc->InsertPoolItem( aTmp, aMark, 0 );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
- pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK);
- }
- else if( *pEnd != *pStt )
- {
- m_pImpl->m_pDoc->InsertPoolItem( aPam, aMark,
- nsSetAttrMode::SETATTR_DONTEXPAND );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
- pStt->nContent, RES_TXTATR_TOXMARK);
- }
- if(pTxtAttr)
- {
- m_pImpl->m_pTOXMark = &pTxtAttr->GetTOXMark();
- }
+ m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
}
else if (m_pImpl->m_bIsDescriptor)
{
@@ -1984,17 +2006,45 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
default:
break;
}
+
+ m_pImpl->InsertTOXMark(*const_cast<SwTOXType *>(pTOXType), aMark, aPam,
+ dynamic_cast<SwXTextCursor const*>(pCursor));
+
+ m_pImpl->m_bIsDescriptor = sal_False;
+}
+
+template<typename T> struct NotContainedIn
+{
+ ::std::vector<T> const& m_rVector;
+ explicit NotContainedIn(::std::vector<T> const& rVector)
+ : m_rVector(rVector) { }
+ bool operator() (T const& rT) {
+ return ::std::find(m_rVector.begin(), m_rVector.end(), rT)
+ == m_rVector.end();
+ }
+};
+
+void SwXDocumentIndexMark::Impl::InsertTOXMark(
+ SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+ SwXTextCursor const*const pTextCursor)
+{
+ SwDoc *const pDoc( rPam.GetDoc() );
UnoActionContext aAction(pDoc);
- const sal_Bool bMark = *aPam.GetPoint() != *aPam.GetMark();
+ bool bMark = *rPam.GetPoint() != *rPam.GetMark();
+ // n.b.: toxmarks must have either alternative text or an extent
+ if (bMark && rMark.GetAlternativeText().Len())
+ {
+ rPam.Normalize(TRUE);
+ rPam.DeleteMark();
+ bMark = false;
+ }
// Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
// deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
- if (!bMark && !aMark.GetAlternativeText().Len())
+ if (!bMark && !rMark.GetAlternativeText().Len())
{
- aMark.SetAlternativeText( String(' ') );
+ rMark.SetAlternativeText( String(' ') );
}
- SwXTextCursor const*const pTextCursor(
- dynamic_cast<SwXTextCursor*>(pCursor));
const bool bForceExpandHints( (!bMark && pTextCursor)
? pTextCursor->IsAtEndOfMeta() : false );
const SetAttrMode nInsertFlags = (bForceExpandHints)
@@ -2002,35 +2052,54 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
| nsSetAttrMode::SETATTR_DONTEXPAND)
: nsSetAttrMode::SETATTR_DONTEXPAND;
- pDoc->InsertPoolItem(aPam, aMark, nInsertFlags);
- if (bMark && *aPam.GetPoint() > *aPam.GetMark())
+ ::std::vector<SwTxtAttr *> oldMarks;
+ if (bMark)
+ {
+ oldMarks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK);
+ }
+
+ pDoc->InsertPoolItem(rPam, rMark, nInsertFlags);
+ if (bMark && *rPam.GetPoint() > *rPam.GetMark())
{
- aPam.Exchange();
+ rPam.Exchange();
}
- SwTxtAttr* pTxtAttr = 0;
+ // rMark was copied into the document pool; now retrieve real format...
+ SwTxtAttr * pTxtAttr(0);
if (bMark)
{
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
- aPam.GetPoint()->nContent, RES_TXTATR_TOXMARK );
+ // #i107672#
+ // ensure that we do not retrieve a different mark at the same position
+ ::std::vector<SwTxtAttr *> const newMarks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
+ ::std::vector<SwTxtAttr *>::const_iterator const iter(
+ ::std::find_if(newMarks.begin(), newMarks.end(),
+ NotContainedIn<SwTxtAttr *>(oldMarks)));
+ OSL_ASSERT(newMarks.end() != iter);
+ if (newMarks.end() != iter)
+ {
+ pTxtAttr = *iter;
+ }
}
else
{
- pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
- aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
}
if (!pTxtAttr)
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXDocumentIndexMark::InsertTOXMark(): cannot insert attribute")),
+ 0);
}
- m_pImpl->m_pTOXMark = &pTxtAttr->GetTOXMark();
- m_pImpl->m_pDoc = pDoc;
- m_pImpl->m_bIsDescriptor = sal_False;
-
- const_cast<SwTOXMark*>(m_pImpl->m_pTOXMark)->Add(m_pImpl.get());
- const_cast<SwTOXType*>(pTOXType)->Add(&m_pImpl->m_TypeDepend);
+ m_pDoc = pDoc;
+ m_pTOXMark = & pTxtAttr->GetTOXMark();
+ const_cast<SwTOXMark*>(m_pTOXMark)->Add(this);
+ const_cast<SwTOXType &>(rTOXType).Add(& m_TypeDepend);
}
/*-- 14.12.98 10:25:45---------------------------------------------------
@@ -2081,7 +2150,7 @@ SwXDocumentIndexMark::dispose() throw (uno::RuntimeException)
SwTOXType *const pType = m_pImpl->GetTOXType();
if (pType && m_pImpl->m_pTOXMark)
{
- m_pImpl->m_pDoc->DeleteTOXMark(m_pImpl->m_pTOXMark);
+ m_pImpl->DeleteTOXMark(); // call Invalidate() via modify!
}
}
/*-- 14.12.98 10:25:45---------------------------------------------------
@@ -2181,8 +2250,6 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
SwTOXType *const pType = m_pImpl->GetTOXType();
if (pType && m_pImpl->m_pTOXMark)
{
- SwDoc* pLocalDoc = m_pImpl->m_pDoc;
-
SwTOXMark aMark(*m_pImpl->m_pTOXMark);
switch(pEntry->nWID)
{
@@ -2225,37 +2292,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
aPam.GetPoint()->nContent++;
}
- //delete the old mark
- pLocalDoc->DeleteTOXMark(m_pImpl->m_pTOXMark);
- m_pImpl->m_pTOXMark = 0;
-
- sal_Bool bInsAtPos = aMark.IsAlternativeText();
- const SwPosition *pStt = aPam.Start();
- const SwPosition *pEnd = aPam.End();
-
- SwTxtAttr* pTxtAttr = 0;
- if( bInsAtPos )
- {
- SwPaM aTmp( *pStt );
- pLocalDoc->InsertPoolItem( aTmp, aMark, 0 );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttrForCharAt(
- pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
- }
- else if( *pEnd != *pStt )
- {
- pLocalDoc->InsertPoolItem( aPam, aMark,
- nsSetAttrMode::SETATTR_DONTEXPAND );
- pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
- pStt->nContent, RES_TXTATR_TOXMARK );
- }
- m_pImpl->m_pDoc = pLocalDoc;
-
- if(pTxtAttr)
- {
- m_pImpl->m_pTOXMark = &pTxtAttr->GetTOXMark();
- const_cast<SwTOXMark*>(m_pImpl->m_pTOXMark)->Add(m_pImpl.get());
- pType->Add(&m_pImpl->m_TypeDepend);
- }
+ m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
}
else if (m_pImpl->m_bIsDescriptor)
{
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 94d1f47fff12..765b1ae37485 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -279,10 +279,11 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
COMMON_CRSR_PARA_PROPERTIES\
{ SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARK), FN_UNO_DOCUMENT_INDEX_MARK, CPPU_E2T(CPPUTYPE_REFDOCIDXMRK), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
{ SW_PROP_NMID(UNO_NAME_TEXT_FIELD), FN_UNO_TEXT_FIELD, CPPU_E2T(CPPUTYPE_REFTXTFIELD), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
- { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID ,0 },\
+ { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\
{ SW_PROP_NMID(UNO_NAME_FOOTNOTE), FN_UNO_FOOTNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
{ SW_PROP_NMID(UNO_NAME_ENDNOTE), FN_UNO_ENDNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
{ SW_PROP_NMID(UNO_NAME_HYPER_LINK_EVENTS), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_REFNMREPLACE), PropertyAttribute::MAYBEVOID, MID_URL_HYPERLINKEVENTS},\
+ { SW_PROP_NMID(UNO_NAME_NESTED_TEXT_CONTENT), FN_UNO_NESTED_TEXT_CONTENT, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },\
TABSTOPS_MAP_ENTRY
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 161afb2373bd..d9334e97c841 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1934,8 +1934,8 @@ lcl_FillFrame(SwClient & rEnum, SwUnoCrsr& rUnoCrsr,
{
// search for objects at the cursor - anchored at/as char
SwTxtAttr const*const pTxtAttr =
- rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttr(
- rUnoCrsr.GetPoint()->nContent, RES_TXTATR_FLYCNT);
+ rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT);
if (pTxtAttr)
{
const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index f049764a2b23..049ccfe42ed7 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -778,6 +778,7 @@ const SwPropNameTab aPropNameTab = {
/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
/* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
+/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
};
const SwPropNameLen& SwGetPropName( USHORT nId )
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 1450e1bd806a..622a995df0ac 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -38,6 +38,7 @@
#include <unomap.hxx>
#include <unocrsr.hxx>
#include <unoevtlstnr.hxx>
+#include <unocrsrhelper.hxx>
#include <doc.hxx>
#include <ndtxt.hxx>
#include <fmtrfmrk.hxx>
@@ -235,6 +236,17 @@ throw (uno::RuntimeException)
/* -----------------03.11.99 14:14-------------------
--------------------------------------------------*/
+template<typename T> struct NotContainedIn
+{
+ ::std::vector<T> const& m_rVector;
+ explicit NotContainedIn(::std::vector<T> const& rVector)
+ : m_rVector(rVector) { }
+ bool operator() (T const& rT) {
+ return ::std::find(m_rVector.begin(), m_rVector.end(), rT)
+ == m_rVector.end();
+ }
+};
+
void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
SwXTextCursor const*const pCursor)
{
@@ -254,6 +266,13 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
| nsSetAttrMode::SETATTR_DONTEXPAND)
: nsSetAttrMode::SETATTR_DONTEXPAND;
+ ::std::vector<SwTxtAttr *> oldMarks;
+ if (bMark)
+ {
+ oldMarks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK);
+ }
+
pDoc2->InsertPoolItem( rPam, aRefMark, nInsertFlags );
if( bMark && *rPam.GetPoint() > *rPam.GetMark())
@@ -261,17 +280,38 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
rPam.Exchange();
}
- SwTxtAttr *const pTxtAttr = (bMark)
- ? rPam.GetNode()->GetTxtNode()->GetTxtAttr(
- rPam.GetPoint()->nContent, RES_TXTATR_REFMARK)
- : rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
+ // aRefMark was copied into the document pool; now retrieve real format...
+ SwTxtAttr * pTxtAttr(0);
+ if (bMark)
+ {
+ // #i107672#
+ // ensure that we do not retrieve a different mark at the same position
+ ::std::vector<SwTxtAttr *> const newMarks(
+ rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
+ rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
+ ::std::vector<SwTxtAttr *>::const_iterator const iter(
+ ::std::find_if(newMarks.begin(), newMarks.end(),
+ NotContainedIn<SwTxtAttr *>(oldMarks)));
+ OSL_ASSERT(newMarks.end() != iter);
+ if (newMarks.end() != iter)
+ {
+ pTxtAttr = *iter;
+ }
+ }
+ else
+ {
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
rPam.GetPoint()->nContent.GetIndex() - 1, RES_TXTATR_REFMARK);
+ }
- if(pTxtAttr)
+ if (!pTxtAttr)
{
- m_pMarkFmt = &pTxtAttr->GetRefMark();
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "SwXReferenceMark::InsertRefMark(): cannot insert attribute")), 0);
}
+ m_pMarkFmt = &pTxtAttr->GetRefMark();
+
pDoc2->GetUnoCallBack()->Add(this);
}
@@ -310,7 +350,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
m_pImpl->InsertRefMark(aPam, dynamic_cast<SwXTextCursor*>(pCursor));
m_pImpl->m_bIsDescriptor = sal_False;
m_pImpl->m_pDoc = pDocument;
- m_pImpl->m_pDoc->GetUnoCallBack()->Add(m_pImpl.get());
}
/*-- 11.12.98 10:28:34---------------------------------------------------
@@ -1159,11 +1198,7 @@ uno::Reference< text::XText > SAL_CALL
SwXMeta::getText() throw (uno::RuntimeException)
{
vos::OGuard g(Application::GetSolarMutex());
- //TODO probably this should return outer meta in case there is nesting,
- // but currently that is not done; would need to change at least
- // SwXTextPortionEnumeration and SwXMeta::attach and other places where
- // SwXMeta is constructed
- return GetParentText();
+ return this;
}
uno::Reference< text::XTextRange > SAL_CALL
@@ -1249,6 +1284,33 @@ SwXMeta::removeTextContent(
return m_pImpl->m_Text.removeTextContent(xContent);
}
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL
+SwXMeta::getParent() throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+ SwTxtNode * pTxtNode;
+ xub_StrLen nMetaStart;
+ xub_StrLen nMetaEnd;
+ bool const bSuccess( SetContentRange(pTxtNode, nMetaStart, nMetaEnd) );
+ OSL_ENSURE(bSuccess, "no pam?");
+ if (!bSuccess) { throw lang::DisposedException(); }
+ // in order to prevent getting this meta, subtract 1 from nMetaStart;
+ // so we get the index of the dummy character, and we exclude it
+ // by calling GetTxtAttrAt(_, _, PARENT) in GetNestedTextContent
+ uno::Reference<text::XTextContent> const xRet(
+ SwUnoCursorHelper::GetNestedTextContent(*pTxtNode, nMetaStart - 1,
+ true) );
+ return xRet;
+}
+
+void SAL_CALL
+SwXMeta::setParent(uno::Reference< uno::XInterface > const& /*xParent*/)
+ throw (uno::RuntimeException, lang::NoSupportException)
+{
+ throw lang::NoSupportException(C2S("setting parent not supported"), *this);
+}
+
// XElementAccess
uno::Type SAL_CALL
SwXMeta::getElementType() throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 3dda0cebec28..1e18cc5becc5 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -369,7 +369,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
String tmp(m_pImpl->m_sName);
- SwSection aSect(eType, pDoc->GetUniqueSectionName(&tmp));
+ SwSectionData aSect(eType, pDoc->GetUniqueSectionName(&tmp));
aSect.SetCondition(m_pImpl->m_pProps->m_sCondition);
::rtl::OUStringBuffer sLinkNameBuf(m_pImpl->m_pProps->m_sLinkFileName);
sLinkNameBuf.append(sfx2::cTokenSeperator);
@@ -379,9 +379,9 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
aSect.SetLinkFileName(sLinkNameBuf.makeStringAndClear());
aSect.SetHidden(m_pImpl->m_pProps->m_bHidden);
- aSect.SetProtect(m_pImpl->m_pProps->m_bProtect);
+ aSect.SetProtectFlag(m_pImpl->m_pProps->m_bProtect);
// --> FME 2004-06-22 #114856# edit in readonly sections
- aSect.SetEditInReadonly(m_pImpl->m_pProps->m_bEditInReadonly);
+ aSect.SetEditInReadonlyFlag(m_pImpl->m_pProps->m_bEditInReadonly);
// <--
SfxItemSet aSet(pDoc->GetAttrPool(),
@@ -427,11 +427,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// section password
if (m_pImpl->m_pProps->m_Password.getLength() > 0)
{
- aSect.SetPasswd(m_pImpl->m_pProps->m_Password);
+ aSect.SetPassword(m_pImpl->m_pProps->m_Password);
}
SwSection *const pRet =
- pDoc->InsertSwSection( aPam, aSect, aSet.Count() ? &aSet : 0 );
+ pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 );
pRet->GetFmt()->Add(m_pImpl.get());
pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
@@ -549,6 +549,56 @@ SwXTextSection::getPropertySetInfo() throw (uno::RuntimeException)
/* -----------------------------12.02.01 10:45--------------------------------
---------------------------------------------------------------------------*/
+static void
+lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways = true)
+{
+ if (rSection.GetType() == DDE_LINK_SECTION)
+ {
+ // set update type; needs an established link
+ if (!rSection.IsConnected())
+ {
+ rSection.CreateLink(CREATE_CONNECT);
+ }
+ rSection.SetUpdateType( static_cast< USHORT >((bLinkUpdateAlways)
+ ? sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
+ }
+}
+
+static void
+lcl_UpdateSection(SwSectionFmt *const pFmt,
+ ::std::auto_ptr<SwSectionData> const& pSectionData,
+ ::std::auto_ptr<SfxItemSet> const& pItemSet,
+ bool const bLinkModeChanged, bool const bLinkUpdateAlways = true)
+{
+ if (pFmt)
+ {
+ SwSection & rSection = *pFmt->GetSection();
+ SwDoc *const pDoc = pFmt->GetDoc();
+ SwSectionFmts const& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ if (rFmts[i]->GetSection()->GetSectionName()
+ == rSection.GetSectionName())
+ {
+ pDoc->UpdateSection(i, *pSectionData, pItemSet.get(),
+ pDoc->IsInReading());
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
+ }
+
+ if (bLinkModeChanged)
+ {
+ lcl_UpdateLinkType(rSection, bLinkUpdateAlways);
+ }
+ // section found and processed: break from loop
+ break;
+ }
+ }
+ }
+}
+
void SwXTextSection::Impl::SetPropertyValues_Impl(
const uno::Sequence< OUString >& rPropertyNames,
const uno::Sequence< uno::Any >& rValues)
@@ -566,12 +616,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
throw uno::RuntimeException();
}
- SwSection aSection(CONTENT_SECTION, aEmptyStr);
- SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0;
- if (pFmt)
- {
- aSection = *pSect;
- }
+ ::std::auto_ptr<SwSectionData> const pSectionData(
+ (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0);
+
OUString const*const pPropertyNames = rPropertyNames.getConstArray();
uno::Any const*const pValues = rValues.getConstArray();
::std::auto_ptr<SfxItemSet> pItemSet;
@@ -609,7 +656,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- aSection.SetCondition(uTmp);
+ pSectionData->SetCondition(uTmp);
}
}
break;
@@ -637,16 +684,16 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- String sLinkFileName(aSection.GetLinkFileName());
- if (aSection.GetType() != DDE_LINK_SECTION)
+ String sLinkFileName(pSectionData->GetLinkFileName());
+ if (pSectionData->GetType() != DDE_LINK_SECTION)
{
sLinkFileName = sfx2::cTokenSeperator;
sLinkFileName += sfx2::cTokenSeperator;
- aSection.SetType(DDE_LINK_SECTION);
+ pSectionData->SetType(DDE_LINK_SECTION);
}
sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,
sfx2::cTokenSeperator, sTmp);
- aSection.SetLinkFileName(sLinkFileName);
+ pSectionData->SetLinkFileName(sLinkFileName);
}
}
break;
@@ -683,10 +730,10 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- if (aSection.GetType() != FILE_LINK_SECTION &&
+ if (pSectionData->GetType() != FILE_LINK_SECTION &&
aLink.FileURL.getLength())
{
- aSection.SetType(FILE_LINK_SECTION);
+ pSectionData->SetType(FILE_LINK_SECTION);
}
::rtl::OUStringBuffer sFileNameBuf;
if (aLink.FileURL.getLength())
@@ -700,14 +747,14 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
sFileNameBuf.append(aLink.FilterName);
sFileNameBuf.append(sfx2::cTokenSeperator);
sFileNameBuf.append(
- aSection.GetLinkFileName().GetToken(2,
+ pSectionData->GetLinkFileName().GetToken(2,
sfx2::cTokenSeperator));
const ::rtl::OUString sFileName(
sFileNameBuf.makeStringAndClear());
- aSection.SetLinkFileName(sFileName);
+ pSectionData->SetLinkFileName(sFileName);
if (sFileName.getLength() < 3)
{
- aSection.SetType(CONTENT_SECTION);
+ pSectionData->SetType(CONTENT_SECTION);
}
}
}
@@ -723,21 +770,21 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- if (aSection.GetType() != FILE_LINK_SECTION &&
+ if (pSectionData->GetType() != FILE_LINK_SECTION &&
sLink.getLength())
{
- aSection.SetType(FILE_LINK_SECTION);
+ pSectionData->SetType(FILE_LINK_SECTION);
}
- String sSectLink(aSection.GetLinkFileName());
+ String sSectLink(pSectionData->GetLinkFileName());
while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator))
{
sSectLink += sfx2::cTokenSeperator;
}
sSectLink.SetToken(2, sfx2::cTokenSeperator, sLink);
- aSection.SetLinkFileName(sSectLink);
+ pSectionData->SetLinkFileName(sSectLink);
if (sSectLink.Len() < 3)
{
- aSection.SetType(CONTENT_SECTION);
+ pSectionData->SetType(CONTENT_SECTION);
}
}
}
@@ -755,7 +802,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- aSection.SetHidden(!bVal);
+ pSectionData->SetHidden(!bVal);
}
}
break;
@@ -772,9 +819,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- if (aSection.GetCondition().Len() != 0)
+ if (pSectionData->GetCondition().Len() != 0)
{
- aSection.SetCondHidden(!bVal);
+ pSectionData->SetCondHidden(!bVal);
}
}
}
@@ -792,7 +839,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- aSection.SetProtect(bVal);
+ pSectionData->SetProtectFlag(bVal);
}
}
break;
@@ -810,7 +857,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- aSection.SetEditInReadonly(bVal);
+ pSectionData->SetEditInReadonlyFlag(bVal);
}
}
// <--
@@ -825,7 +872,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
else
{
- aSection.SetPasswd(aSeq);
+ pSectionData->SetPassword(aSeq);
}
}
break;
@@ -925,38 +972,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
}
- if (pFmt)
- {
- SwDoc* pDoc = pFmt->GetDoc();
- const SwSectionFmts& rFmts = pDoc->GetSections();
- UnoActionContext aContext(pDoc);
- for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
- {
- if (rFmts[i]->GetSection()->GetName() == pSect->GetName())
- {
- pDoc->ChgSection(i, aSection, pItemSet.get(),
- pDoc->IsInReading());
- {
- // temporarily remove actions to allow cursor update
- UnoActionRemoveContext aRemoveContext( pDoc );
- }
-
- //SwSection* pSect = pFmt->GetSection();
- if (bLinkModeChanged && pSect->GetType() == DDE_LINK_SECTION)
- {
- // set update type; needs an established link
- if (!pSect->IsConnected())
- {
- pSect->CreateLink(CREATE_CONNECT);
- }
- pSect->SetUpdateType( static_cast< USHORT >((bLinkMode) ?
- sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) );
- }
- // section found and processed: break from loop
- break;
- }
- }
- }
+ lcl_UpdateSection(pFmt, pSectionData, pItemSet, bLinkModeChanged,
+ bLinkMode);
}
void SAL_CALL
@@ -1147,7 +1164,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
{
if (pFmt)
{
- pRet[nProperty] <<= OUString(pFmt->GetSection()->GetName());
+ pRet[nProperty] <<=
+ OUString(pFmt->GetSection()->GetSectionName());
}
}
break;
@@ -1222,7 +1240,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
case WID_SECT_PASSWORD:
{
pRet[nProperty] <<= (m_bIsDescriptor)
- ? m_pProps->m_Password : pSect->GetPasswd();
+ ? m_pProps->m_Password : pSect->GetPassword();
}
break;
default:
@@ -1562,12 +1580,6 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
throw uno::RuntimeException();
}
- SwSection aSection(CONTENT_SECTION, aEmptyStr);
- SwSection *const pSect = (pFmt) ? pFmt->GetSection() : 0;
- if (pFmt)
- {
- aSection = *pSect;
- }
SfxItemPropertySimpleEntry const*const pEntry =
m_pImpl->m_rPropSet.getPropertyMap()->getByName(rPropertyName);
if (!pEntry)
@@ -1584,7 +1596,12 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
static_cast<cppu::OWeakObject *>(this));
}
+ ::std::auto_ptr<SwSectionData> const pSectionData(
+ (pFmt) ? new SwSectionData(*pFmt->GetSection()) : 0);
+
::std::auto_ptr<SfxItemSet> pNewAttrSet;
+ bool bLinkModeChanged = false;
+
switch (pEntry->nWID)
{
case WID_SECT_CONDITION:
@@ -1595,7 +1612,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
else
{
- aSection.SetCondition(aEmptyStr);
+ pSectionData->SetCondition(aEmptyStr);
}
}
break;
@@ -1604,10 +1621,27 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
case WID_SECT_DDE_ELEMENT :
case WID_SECT_LINK :
case WID_SECT_REGION :
- aSection.SetType(CONTENT_SECTION);
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bDDE = false;
+ m_pImpl->m_pProps->m_sLinkFileName = ::rtl::OUString();
+ m_pImpl->m_pProps->m_sSectionRegion = ::rtl::OUString();
+ m_pImpl->m_pProps->m_sSectionFilter = ::rtl::OUString();
+ }
+ else
+ {
+ pSectionData->SetType(CONTENT_SECTION);
+ }
break;
case WID_SECT_DDE_AUTOUPDATE:
- aSection.SetUpdateType(sfx2::LINKUPDATE_ALWAYS);
+ if (m_pImpl->m_bIsDescriptor)
+ {
+ m_pImpl->m_pProps->m_bUpdateType = true;
+ }
+ else
+ {
+ bLinkModeChanged = true;
+ }
break;
case WID_SECT_VISIBLE :
{
@@ -1617,7 +1651,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
else
{
- aSection.SetHidden(FALSE);
+ pSectionData->SetHidden(false);
}
}
break;
@@ -1629,7 +1663,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
else
{
- aSection.SetProtect(FALSE);
+ pSectionData->SetProtectFlag(false);
}
}
break;
@@ -1642,7 +1676,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
else
{
- aSection.SetEditInReadonly(FALSE);
+ pSectionData->SetEditInReadonlyFlag(false);
}
}
break;
@@ -1678,25 +1712,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
}
}
- if (pFmt)
- {
- SwDoc *const pDoc = pFmt->GetDoc();
- const SwSectionFmts& rFmts = pDoc->GetSections();
- UnoActionContext aContext(pDoc);
- for (sal_uInt16 i = 0; i < rFmts.Count(); i++)
- {
- if (rFmts[i]->GetSection()->GetName() == pSect->GetName())
- {
- pDoc->ChgSection(i, aSection, pNewAttrSet.get(),
- pDoc->IsInReading());
- {
- // temporarily remove actions to allow cursor update
- UnoActionRemoveContext aRemoveContext( pDoc );
- }
- break;
- }
- }
- }
+ lcl_UpdateSection(pFmt, pSectionData, pNewAttrSet, bLinkModeChanged);
}
/*-- 08.11.00 10:47:56---------------------------------------------------
@@ -1737,7 +1753,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
case WID_SECT_DDE_AUTOUPDATE:
case WID_SECT_VISIBLE :
{
- sal_Bool bTemp = TRUE;
+ sal_Bool bTemp = sal_True;
aRet.setValue( &bTemp, ::getCppuBooleanType());
}
break;
@@ -1746,7 +1762,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
case WID_SECT_EDIT_IN_READONLY:
// <--
{
- sal_Bool bTemp = FALSE;
+ sal_Bool bTemp = sal_False;
aRet.setValue( &bTemp, ::getCppuBooleanType());
}
break;
@@ -1778,7 +1794,7 @@ OUString SAL_CALL SwXTextSection::getName() throw (uno::RuntimeException)
SwSectionFmt const*const pFmt = m_pImpl->GetSectionFmt();
if(pFmt)
{
- sRet = pFmt->GetSection()->GetName();
+ sRet = pFmt->GetSection()->GetSectionName();
}
else if (m_pImpl->m_bIsDescriptor)
{
@@ -1801,11 +1817,10 @@ throw (uno::RuntimeException)
SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
if(pFmt)
{
- SwSection aSection(CONTENT_SECTION, aEmptyStr);
SwSection *const pSect = pFmt->GetSection();
- aSection = *pSect;
+ SwSectionData aSection(*pSect);
String sNewName(rName);
- aSection.SetName(sNewName);
+ aSection.SetSectionName(sNewName);
const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
sal_uInt16 nApplyPos = USHRT_MAX;
@@ -1815,7 +1830,7 @@ throw (uno::RuntimeException)
{
nApplyPos = i;
}
- else if(sNewName == rFmts[i]->GetSection()->GetName())
+ else if (sNewName == rFmts[i]->GetSection()->GetSectionName())
{
throw uno::RuntimeException();
}
@@ -1824,7 +1839,7 @@ throw (uno::RuntimeException)
{
{
UnoActionContext aContext(pFmt->GetDoc());
- pFmt->GetDoc()->ChgSection( nApplyPos, aSection);
+ pFmt->GetDoc()->UpdateSection(nApplyPos, aSection);
}
{
// temporarily remove actions to allow cursor update
@@ -1879,3 +1894,22 @@ SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException)
g_nServicesTextSection, g_ServicesTextSection);
}
+
+// MetadatableMixin
+::sfx2::Metadatable* SwXTextSection::GetCoreObject()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ return pSectionFmt;
+}
+
+uno::Reference<frame::XModel> SwXTextSection::GetModel()
+{
+ SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
+ if (pSectionFmt)
+ {
+ SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() );
+ return (pShell) ? pShell->GetModel() : 0;
+ }
+ return 0;
+}
+
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 04bc229627a9..b2d91c48f598 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -430,7 +430,7 @@ void SwViewImp::DisposeAccessible( const SwFrm *pFrm,
do
{
if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, bRecursive );
+ pTmp->Imp()->GetAccessibleMap().Dispose( pFrm, pObj, 0, bRecursive );
pTmp = (ViewShell *)pTmp->GetNext();
} while ( pTmp != pVSh );
}
@@ -444,7 +444,7 @@ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
do
{
if( pTmp->Imp()->IsAccessible() )
- pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj,
+ pTmp->Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrm, pObj, 0,
rOldFrm );
pTmp = (ViewShell *)pTmp->GetNext();
} while ( pTmp != pVSh );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 08aae426fd8c..156447fda9da 100755
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1231,16 +1231,23 @@ void ViewShell::VisPortChgd( const SwRect &rRect)
SwTwips nPageLeft = 0;
SwTwips nPageRight = 0;
- if (pPage->MarginSide())
+ switch ( pPage->SidebarPosition() )
{
- nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth;
- nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth;
- }
- else
- {
- // OD 03.03.2003 #107927# - use correct datatype
- nPageLeft = aPageRect.Left() - nBorderWidth;
- nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth;
+ nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth;
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ nPageLeft = aPageRect.Left() - nBorderWidth;
+ nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_NONE:
+ // nothing to do
+ break;
}
if( nPageLeft < nMinLeft )
nMinLeft = nPageLeft;
@@ -1310,6 +1317,15 @@ void ViewShell::VisPortChgd( const SwRect &rRect)
}
GetWin()->Update();
+ // --> OD 2010-02-11 #i88070#
+ if ( pPostItMgr )
+ {
+ pPostItMgr->Rescale();
+ pPostItMgr->CalcRects();
+ pPostItMgr->LayoutPostIts();
+ }
+ // <--
+
if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
pPostItMgr->CorrectPositions();
@@ -1708,7 +1724,8 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
aPageRect.SSize() = rFormatPage.Frm().SSize();
}
- const bool bSidebarRight = !static_cast<const SwPageFrm*>(pPage)->MarginSide();
+ const bool bSidebarRight =
+ static_cast<const SwPageFrm*>(pPage)->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
aPageRect.Pos().X() -= bSidebarRight ? 0 : nSidebarWidth;
aPageRect.SSize().Width() += nSidebarWidth;
@@ -2591,6 +2608,15 @@ void ViewShell::InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
}
}
+SwAccessibleMap* ViewShell::GetAccessibleMap()
+{
+ if ( Imp()->IsAccessible() )
+ {
+ return &(Imp()->GetAccessibleMap());
+ }
+
+ return 0;
+}
/* -----------------------------06.05.2002 13:23------------------------------
---------------------------------------------------------------------------*/