office-gobmx/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx

226 lines
6.8 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* 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.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include <editeng/unoedhlp.hxx>
#include <svx/svdoutl.hxx>
#ifndef SD_ACCESSIBILITY_ACCESSIBLE_OUTLINE_EDIT_SOURCE_HXX
#include <AccessibleOutlineEditSource.hxx>
#endif
#include "OutlineView.hxx"
#include <svx/sdrpaintwindow.hxx>
namespace accessibility
{
AccessibleOutlineEditSource::AccessibleOutlineEditSource(
SdrOutliner& rOutliner,
SdrView& rView,
OutlinerView& rOutlView,
const ::Window& rViewWindow )
: mrView( rView ),
mrWindow( rViewWindow ),
mpOutliner( &rOutliner ),
mpOutlinerView( &rOutlView ),
mTextForwarder( rOutliner, NULL ),
mViewForwarder( rOutlView )
{
// register as listener - need to broadcast state change messages
rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) );
CWS-TOOLING: integrate CWS impress169 2009-05-13 17:37:21 +0200 sj r271865 : #i100942# applied patch, removed oversafe buffer check (now without warnings on 64 bit platform) 2009-05-13 12:27:18 +0200 sj r271855 : #i101769# fixed line/fill attributes for graphic objects 2009-05-12 10:25:17 +0200 cl r271799 : report correct minimum cell hight for empty cells 2009-04-28 17:29:46 +0200 cl r271334 : fixed merge error 2009-04-28 16:18:01 +0200 cl r271330 : fixed build error 2009-04-28 12:38:09 +0200 cl r271320 : #i100129# images for new layouts 2009-04-27 19:12:06 +0200 cl r271302 : CWS-TOOLING: rebase CWS impress169 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 19:13:28 +0200 sj r271012 : #i100942# applied patch, removed oversafe buffer check 2009-04-09 18:00:01 +0200 sj r270719 : #158488# added rectangular gradient support 2009-04-09 17:49:52 +0200 sj r270718 : #158488# added rectangular gradient support 2009-04-09 17:46:24 +0200 sj r270717 : #158488# added rectangular gradient support 2009-03-26 18:16:34 +0100 cl r270098 : #i99867# applied patch from jlcheng to correctly register table design pane 2009-03-26 18:12:11 +0100 cl r270097 : #i100220# leave some items default so they are not overridden if a new table style is set 2009-03-26 18:11:10 +0100 cl r270096 : #i100220# clear only those items that are also in the style when assigning a new table layout 2009-03-26 15:56:24 +0100 cl r270085 : #i99977# listen to outliner and dispose if outliner dies 2009-03-26 15:47:29 +0100 cl r270084 : #i99977# made the Outliner a SfxBroadcaster so others can listen for its death 2009-03-24 19:10:05 +0100 sj r269991 : #i100490# fixed text resize problem 2009-03-23 14:31:11 +0100 sj r269872 : #i96083# added patch, (dubious && and ||) 2009-03-19 17:55:11 +0100 sj r269764 : #i100275# applied patch, row height is now correct even for rows containing no text 2009-03-18 18:10:52 +0100 sj r269701 : #i93616# solved performance problem when loading document 2009-03-18 16:20:40 +0100 sj r269688 : removing unused code 2009-03-18 16:19:22 +0100 sj r269687 : removing unused code 2009-03-18 16:17:54 +0100 sj r269686 : removing unused code 2009-03-18 10:28:07 +0100 cl r269643 : #i100029# let cells be disposed as soon as the table model is disposed 2009-03-17 15:56:50 +0100 cl r269614 : #i99984# new impress photo layouts 3x2 and 2x2 2009-03-17 15:36:35 +0100 cl r269611 : #i99984# adding new impress photo layouts 3x2 and 2x2 2009-03-16 18:43:48 +0100 cl r269564 : #i55224# correct internal links if pages are changed 2009-03-16 16:40:38 +0100 cl r269559 : #i55224# correct internal hyperlinks if slides are changed/renamed 2009-03-16 15:34:12 +0100 cl r269553 : #i99427# invalidate slots after promote/demote 2009-03-13 18:18:20 +0100 sj r269492 : #i92421# fixed loop if loading encrypted ppt file 2009-03-13 14:51:58 +0100 sj r269481 : #i93002# fixed crash if saving presentation without master title placeholder 2009-03-13 12:26:21 +0100 sj r269468 : #i100147# do not exceed the max point count if creating simple polygon via ::GetSimple 2009-03-12 17:00:45 +0100 sj r269427 : #i82518# justifying rectangles for arc/pie and chord actions, fixed round rectangle problem
2009-05-19 04:32:45 -05:00
StartListening(rOutliner);
}
AccessibleOutlineEditSource::~AccessibleOutlineEditSource()
{
if( mpOutliner )
mpOutliner->SetNotifyHdl( Link() );
Broadcast( TextHint( SFX_HINT_DYING ) );
}
SvxEditSource* AccessibleOutlineEditSource::Clone() const
{
return NULL;
}
SvxTextForwarder* AccessibleOutlineEditSource::GetTextForwarder()
{
// TODO: maybe suboptimal
if( IsValid() )
return &mTextForwarder;
else
return NULL;
}
SvxViewForwarder* AccessibleOutlineEditSource::GetViewForwarder()
{
// TODO: maybe suboptimal
if( IsValid() )
return this;
else
return NULL;
}
SvxEditViewForwarder* AccessibleOutlineEditSource::GetEditViewForwarder( sal_Bool )
{
// TODO: maybe suboptimal
if( IsValid() )
{
// ignore parameter, we're always in edit mode here
return &mViewForwarder;
}
else
return NULL;
}
void AccessibleOutlineEditSource::UpdateData()
{
// NOOP, since we're always working on the 'real' outliner,
// i.e. changes are immediately reflected on the screen
}
SfxBroadcaster& AccessibleOutlineEditSource::GetBroadcaster() const
{
return *( const_cast< AccessibleOutlineEditSource* > (this) );
}
BOOL AccessibleOutlineEditSource::IsValid() const
{
if( mpOutliner && mpOutlinerView )
{
// Our view still on outliner?
ULONG nCurrView, nViews;
for( nCurrView=0, nViews=mpOutliner->GetViewCount(); nCurrView<nViews; ++nCurrView )
{
if( mpOutliner->GetView(nCurrView) == mpOutlinerView )
return sal_True;
}
}
return sal_False;
}
Rectangle AccessibleOutlineEditSource::GetVisArea() const
{
if( IsValid() )
{
SdrPaintWindow* pPaintWindow = mrView.FindPaintWindow(mrWindow);
Rectangle aVisArea;
if(pPaintWindow)
{
aVisArea = pPaintWindow->GetVisibleArea();
}
MapMode aMapMode(mrWindow.GetMapMode());
aMapMode.SetOrigin(Point());
return mrWindow.LogicToPixel( aVisArea, aMapMode );
}
return Rectangle();
}
Point AccessibleOutlineEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
{
if( IsValid() && mrView.GetModel() )
{
Point aPoint( OutputDevice::LogicToLogic( rPoint, rMapMode,
MapMode(mrView.GetModel()->GetScaleUnit()) ) );
MapMode aMapMode(mrWindow.GetMapMode());
aMapMode.SetOrigin(Point());
return mrWindow.LogicToPixel( aPoint, aMapMode );
}
return Point();
}
Point AccessibleOutlineEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
{
if( IsValid() && mrView.GetModel() )
{
MapMode aMapMode(mrWindow.GetMapMode());
aMapMode.SetOrigin(Point());
Point aPoint( mrWindow.PixelToLogic( rPoint, aMapMode ) );
return OutputDevice::LogicToLogic( aPoint,
MapMode(mrView.GetModel()->GetScaleUnit()),
rMapMode );
}
return Point();
}
CWS-TOOLING: integrate CWS impress169 2009-05-13 17:37:21 +0200 sj r271865 : #i100942# applied patch, removed oversafe buffer check (now without warnings on 64 bit platform) 2009-05-13 12:27:18 +0200 sj r271855 : #i101769# fixed line/fill attributes for graphic objects 2009-05-12 10:25:17 +0200 cl r271799 : report correct minimum cell hight for empty cells 2009-04-28 17:29:46 +0200 cl r271334 : fixed merge error 2009-04-28 16:18:01 +0200 cl r271330 : fixed build error 2009-04-28 12:38:09 +0200 cl r271320 : #i100129# images for new layouts 2009-04-27 19:12:06 +0200 cl r271302 : CWS-TOOLING: rebase CWS impress169 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 19:13:28 +0200 sj r271012 : #i100942# applied patch, removed oversafe buffer check 2009-04-09 18:00:01 +0200 sj r270719 : #158488# added rectangular gradient support 2009-04-09 17:49:52 +0200 sj r270718 : #158488# added rectangular gradient support 2009-04-09 17:46:24 +0200 sj r270717 : #158488# added rectangular gradient support 2009-03-26 18:16:34 +0100 cl r270098 : #i99867# applied patch from jlcheng to correctly register table design pane 2009-03-26 18:12:11 +0100 cl r270097 : #i100220# leave some items default so they are not overridden if a new table style is set 2009-03-26 18:11:10 +0100 cl r270096 : #i100220# clear only those items that are also in the style when assigning a new table layout 2009-03-26 15:56:24 +0100 cl r270085 : #i99977# listen to outliner and dispose if outliner dies 2009-03-26 15:47:29 +0100 cl r270084 : #i99977# made the Outliner a SfxBroadcaster so others can listen for its death 2009-03-24 19:10:05 +0100 sj r269991 : #i100490# fixed text resize problem 2009-03-23 14:31:11 +0100 sj r269872 : #i96083# added patch, (dubious && and ||) 2009-03-19 17:55:11 +0100 sj r269764 : #i100275# applied patch, row height is now correct even for rows containing no text 2009-03-18 18:10:52 +0100 sj r269701 : #i93616# solved performance problem when loading document 2009-03-18 16:20:40 +0100 sj r269688 : removing unused code 2009-03-18 16:19:22 +0100 sj r269687 : removing unused code 2009-03-18 16:17:54 +0100 sj r269686 : removing unused code 2009-03-18 10:28:07 +0100 cl r269643 : #i100029# let cells be disposed as soon as the table model is disposed 2009-03-17 15:56:50 +0100 cl r269614 : #i99984# new impress photo layouts 3x2 and 2x2 2009-03-17 15:36:35 +0100 cl r269611 : #i99984# adding new impress photo layouts 3x2 and 2x2 2009-03-16 18:43:48 +0100 cl r269564 : #i55224# correct internal links if pages are changed 2009-03-16 16:40:38 +0100 cl r269559 : #i55224# correct internal hyperlinks if slides are changed/renamed 2009-03-16 15:34:12 +0100 cl r269553 : #i99427# invalidate slots after promote/demote 2009-03-13 18:18:20 +0100 sj r269492 : #i92421# fixed loop if loading encrypted ppt file 2009-03-13 14:51:58 +0100 sj r269481 : #i93002# fixed crash if saving presentation without master title placeholder 2009-03-13 12:26:21 +0100 sj r269468 : #i100147# do not exceed the max point count if creating simple polygon via ::GetSimple 2009-03-12 17:00:45 +0100 sj r269427 : #i82518# justifying rectangles for arc/pie and chord actions, fixed round rectangle problem
2009-05-19 04:32:45 -05:00
void AccessibleOutlineEditSource::Notify( SfxBroadcaster& rBroadcaster, const SfxHint& rHint )
{
CWS-TOOLING: integrate CWS impress169 2009-05-13 17:37:21 +0200 sj r271865 : #i100942# applied patch, removed oversafe buffer check (now without warnings on 64 bit platform) 2009-05-13 12:27:18 +0200 sj r271855 : #i101769# fixed line/fill attributes for graphic objects 2009-05-12 10:25:17 +0200 cl r271799 : report correct minimum cell hight for empty cells 2009-04-28 17:29:46 +0200 cl r271334 : fixed merge error 2009-04-28 16:18:01 +0200 cl r271330 : fixed build error 2009-04-28 12:38:09 +0200 cl r271320 : #i100129# images for new layouts 2009-04-27 19:12:06 +0200 cl r271302 : CWS-TOOLING: rebase CWS impress169 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 19:13:28 +0200 sj r271012 : #i100942# applied patch, removed oversafe buffer check 2009-04-09 18:00:01 +0200 sj r270719 : #158488# added rectangular gradient support 2009-04-09 17:49:52 +0200 sj r270718 : #158488# added rectangular gradient support 2009-04-09 17:46:24 +0200 sj r270717 : #158488# added rectangular gradient support 2009-03-26 18:16:34 +0100 cl r270098 : #i99867# applied patch from jlcheng to correctly register table design pane 2009-03-26 18:12:11 +0100 cl r270097 : #i100220# leave some items default so they are not overridden if a new table style is set 2009-03-26 18:11:10 +0100 cl r270096 : #i100220# clear only those items that are also in the style when assigning a new table layout 2009-03-26 15:56:24 +0100 cl r270085 : #i99977# listen to outliner and dispose if outliner dies 2009-03-26 15:47:29 +0100 cl r270084 : #i99977# made the Outliner a SfxBroadcaster so others can listen for its death 2009-03-24 19:10:05 +0100 sj r269991 : #i100490# fixed text resize problem 2009-03-23 14:31:11 +0100 sj r269872 : #i96083# added patch, (dubious && and ||) 2009-03-19 17:55:11 +0100 sj r269764 : #i100275# applied patch, row height is now correct even for rows containing no text 2009-03-18 18:10:52 +0100 sj r269701 : #i93616# solved performance problem when loading document 2009-03-18 16:20:40 +0100 sj r269688 : removing unused code 2009-03-18 16:19:22 +0100 sj r269687 : removing unused code 2009-03-18 16:17:54 +0100 sj r269686 : removing unused code 2009-03-18 10:28:07 +0100 cl r269643 : #i100029# let cells be disposed as soon as the table model is disposed 2009-03-17 15:56:50 +0100 cl r269614 : #i99984# new impress photo layouts 3x2 and 2x2 2009-03-17 15:36:35 +0100 cl r269611 : #i99984# adding new impress photo layouts 3x2 and 2x2 2009-03-16 18:43:48 +0100 cl r269564 : #i55224# correct internal links if pages are changed 2009-03-16 16:40:38 +0100 cl r269559 : #i55224# correct internal hyperlinks if slides are changed/renamed 2009-03-16 15:34:12 +0100 cl r269553 : #i99427# invalidate slots after promote/demote 2009-03-13 18:18:20 +0100 sj r269492 : #i92421# fixed loop if loading encrypted ppt file 2009-03-13 14:51:58 +0100 sj r269481 : #i93002# fixed crash if saving presentation without master title placeholder 2009-03-13 12:26:21 +0100 sj r269468 : #i100147# do not exceed the max point count if creating simple polygon via ::GetSimple 2009-03-12 17:00:45 +0100 sj r269427 : #i82518# justifying rectangles for arc/pie and chord actions, fixed round rectangle problem
2009-05-19 04:32:45 -05:00
bool bDispose = false;
CWS-TOOLING: integrate CWS impress169 2009-05-13 17:37:21 +0200 sj r271865 : #i100942# applied patch, removed oversafe buffer check (now without warnings on 64 bit platform) 2009-05-13 12:27:18 +0200 sj r271855 : #i101769# fixed line/fill attributes for graphic objects 2009-05-12 10:25:17 +0200 cl r271799 : report correct minimum cell hight for empty cells 2009-04-28 17:29:46 +0200 cl r271334 : fixed merge error 2009-04-28 16:18:01 +0200 cl r271330 : fixed build error 2009-04-28 12:38:09 +0200 cl r271320 : #i100129# images for new layouts 2009-04-27 19:12:06 +0200 cl r271302 : CWS-TOOLING: rebase CWS impress169 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 19:13:28 +0200 sj r271012 : #i100942# applied patch, removed oversafe buffer check 2009-04-09 18:00:01 +0200 sj r270719 : #158488# added rectangular gradient support 2009-04-09 17:49:52 +0200 sj r270718 : #158488# added rectangular gradient support 2009-04-09 17:46:24 +0200 sj r270717 : #158488# added rectangular gradient support 2009-03-26 18:16:34 +0100 cl r270098 : #i99867# applied patch from jlcheng to correctly register table design pane 2009-03-26 18:12:11 +0100 cl r270097 : #i100220# leave some items default so they are not overridden if a new table style is set 2009-03-26 18:11:10 +0100 cl r270096 : #i100220# clear only those items that are also in the style when assigning a new table layout 2009-03-26 15:56:24 +0100 cl r270085 : #i99977# listen to outliner and dispose if outliner dies 2009-03-26 15:47:29 +0100 cl r270084 : #i99977# made the Outliner a SfxBroadcaster so others can listen for its death 2009-03-24 19:10:05 +0100 sj r269991 : #i100490# fixed text resize problem 2009-03-23 14:31:11 +0100 sj r269872 : #i96083# added patch, (dubious && and ||) 2009-03-19 17:55:11 +0100 sj r269764 : #i100275# applied patch, row height is now correct even for rows containing no text 2009-03-18 18:10:52 +0100 sj r269701 : #i93616# solved performance problem when loading document 2009-03-18 16:20:40 +0100 sj r269688 : removing unused code 2009-03-18 16:19:22 +0100 sj r269687 : removing unused code 2009-03-18 16:17:54 +0100 sj r269686 : removing unused code 2009-03-18 10:28:07 +0100 cl r269643 : #i100029# let cells be disposed as soon as the table model is disposed 2009-03-17 15:56:50 +0100 cl r269614 : #i99984# new impress photo layouts 3x2 and 2x2 2009-03-17 15:36:35 +0100 cl r269611 : #i99984# adding new impress photo layouts 3x2 and 2x2 2009-03-16 18:43:48 +0100 cl r269564 : #i55224# correct internal links if pages are changed 2009-03-16 16:40:38 +0100 cl r269559 : #i55224# correct internal hyperlinks if slides are changed/renamed 2009-03-16 15:34:12 +0100 cl r269553 : #i99427# invalidate slots after promote/demote 2009-03-13 18:18:20 +0100 sj r269492 : #i92421# fixed loop if loading encrypted ppt file 2009-03-13 14:51:58 +0100 sj r269481 : #i93002# fixed crash if saving presentation without master title placeholder 2009-03-13 12:26:21 +0100 sj r269468 : #i100147# do not exceed the max point count if creating simple polygon via ::GetSimple 2009-03-12 17:00:45 +0100 sj r269427 : #i82518# justifying rectangles for arc/pie and chord actions, fixed round rectangle problem
2009-05-19 04:32:45 -05:00
if( &rBroadcaster == mpOutliner )
{
const SfxSimpleHint* pHint = dynamic_cast< const SfxSimpleHint * >( &rHint );
if( pHint && (pHint->GetId() == SFX_HINT_DYING) )
{
bDispose = true;
mpOutliner = NULL;
}
}
else
{
const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
if( pSdrHint && ( pSdrHint->GetKind() == HINT_MODELCLEARED ) )
{
// model is dying under us, going defunc
bDispose = true;
}
}
if( bDispose )
{
if( mpOutliner )
mpOutliner->SetNotifyHdl( Link() );
mpOutliner = NULL;
mpOutlinerView = NULL;
Broadcast( TextHint( SFX_HINT_DYING ) );
}
}
IMPL_LINK(AccessibleOutlineEditSource, NotifyHdl, EENotify*, aNotify)
{
if( aNotify )
{
::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) );
if( aHint.get() )
Broadcast( *aHint.get() );
}
return 0;
}
} // end of namespace accessibility