Files
libreoffice/sw/inc/accmap.hxx

328 lines
12 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SW_INC_ACCMAP_HXX
#define INCLUDED_SW_INC_ACCMAP_HXX
2002-02-04 13:10:18 +00:00
#include <cppuhelper/weakref.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
2010-10-15 11:44:38 -05:00
#include <rtl/ref.hxx>
#include <osl/mutex.hxx>
2002-05-15 12:22:47 +00:00
#include <svx/IAccessibleViewForwarder.hxx>
#include <svx/IAccessibleParent.hxx>
2002-05-22 10:48:43 +00:00
#include <tools/fract.hxx>
#include <svx/AccessibleControlShape.hxx>
#include <svx/AccessibleShape.hxx>
#include "fesh.hxx"
2002-05-22 10:48:43 +00:00
#include <vector>
#include <set>
class SwAccessibleParagraph;
2002-05-22 10:48:43 +00:00
class SwViewShell;
2002-02-04 13:10:18 +00:00
class Rectangle;
class SwFrm;
class SwTxtFrm;
2002-05-29 14:06:25 +00:00
class SwPageFrm;
2002-02-04 13:10:18 +00:00
class SwAccessibleContext;
class SwAccessibleContextMap_Impl;
class SwAccessibleEventList_Impl;
class SwAccessibleEventMap_Impl;
2002-05-15 12:22:47 +00:00
class SwShapeList_Impl;
2002-05-06 11:26:27 +00:00
class SdrObject;
namespace accessibility {
class AccessibleShape;
}
2002-05-06 11:26:27 +00:00
class SwAccessibleShapeMap_Impl;
struct SwAccessibleEvent_Impl;
class SwAccessibleSelectedParas_Impl;
2002-02-11 11:51:16 +00:00
class SwRect;
class MapMode;
2002-05-22 10:48:43 +00:00
class SwAccPreviewData;
struct PreviewPage;
class Window;
2002-04-17 13:26:24 +00:00
// real states for events
2002-03-21 11:56:53 +00:00
#define ACC_STATE_EDITABLE 0x01
#define ACC_STATE_OPAQUE 0x02
2002-04-17 13:26:24 +00:00
// pseudo states for events
#define ACC_STATE_TEXT_ATTRIBUTE_CHANGED 0x0200
#define ACC_STATE_TEXT_SELECTION_CHANGED 0x0100
2002-03-21 11:56:53 +00:00
#define ACC_STATE_CARET 0x80
#define ACC_STATE_RELATION_FROM 0x40
#define ACC_STATE_RELATION_TO 0x20
2002-03-21 11:56:53 +00:00
#define ACC_STATE_RELATION_MASK 0x60
#define ACC_STATE_MASK 0x1F
2002-03-21 11:56:53 +00:00
typedef sal_uInt16 tAccessibleStates;
class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
public ::accessibility::IAccessibleParent
2002-02-04 13:10:18 +00:00
{
mutable ::osl::Mutex maMutex;
::osl::Mutex maEventMutex;
2002-05-06 11:26:27 +00:00
SwAccessibleContextMap_Impl *mpFrmMap;
SwAccessibleShapeMap_Impl *mpShapeMap;
2002-05-15 12:22:47 +00:00
SwShapeList_Impl *mpShapes;
2002-04-17 13:26:24 +00:00
SwAccessibleEventList_Impl *mpEvents;
SwAccessibleEventMap_Impl *mpEventMap;
// #i27301 data structure to keep information about
// accessible paragraph, which have a selection.
SwAccessibleSelectedParas_Impl* mpSelectedParas;
SwViewShell *mpVSh;
2002-05-29 14:06:25 +00:00
/// for page preview: store preview data, VisArea, and mapping of
/// preview-to-display coordinates
SwAccPreviewData* mpPreview;
2002-05-15 12:22:47 +00:00
::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible > mxCursorContext;
2002-05-15 12:22:47 +00:00
2002-04-17 13:26:24 +00:00
sal_Int32 mnPara;
2002-05-22 10:48:43 +00:00
bool mbShapeSelected;
2002-05-15 12:22:47 +00:00
void FireEvent( const SwAccessibleEvent_Impl& rEvent );
2002-05-22 10:48:43 +00:00
void AppendEvent( const SwAccessibleEvent_Impl& rEvent );
2002-04-05 11:18:25 +00:00
void InvalidateCursorPosition(
2002-03-21 11:56:53 +00:00
const ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>& rAcc );
void DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode = sal_False);
2002-05-15 12:22:47 +00:00
void InvalidateShapeSelection();
2002-03-21 11:56:53 +00:00
//mpSelectedFrmMap contains the old selected objects.
SwAccessibleContextMap_Impl *mpSeletedFrmMap;
//IvalidateShapeInParaSelection() method is reponsible for the updating the selected states of the objects.
void InvalidateShapeInParaSelection();
void _InvalidateRelationSet( const SwFrm* pFrm, bool bFrom );
2002-05-22 10:48:43 +00:00
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>
_GetDocumentView( bool bPagePreview );
2002-05-22 10:48:43 +00:00
/** method to build up a new data structure of the accessible pararaphs,
which have a selection
Important note: method has to used inside a mutual exclusive section
@author OD
*/
SwAccessibleSelectedParas_Impl* _BuildSelectedParas();
2002-02-04 13:10:18 +00:00
public:
SwAccessibleMap( SwViewShell *pSh );
2002-02-04 13:10:18 +00:00
~SwAccessibleMap();
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> GetDocumentView();
2002-02-04 13:10:18 +00:00
2002-05-22 10:48:43 +00:00
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> GetDocumentPreview(
const std::vector<PreviewPage*>& _rPreviewPages,
const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
2002-05-22 10:48:43 +00:00
2010-10-15 11:44:38 -05:00
::rtl::Reference < SwAccessibleContext > GetContextImpl(
2002-02-11 11:51:16 +00:00
const SwFrm *pFrm,
sal_Bool bCreate = sal_True );
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> GetContext(
2002-02-11 11:51:16 +00:00
const SwFrm *pFrm,
sal_Bool bCreate = sal_True );
2010-10-15 11:44:38 -05:00
::rtl::Reference < ::accessibility::AccessibleShape > GetContextImpl(
2002-05-06 11:26:27 +00:00
const SdrObject *pObj,
2002-05-15 12:22:47 +00:00
SwAccessibleContext *pParentImpl,
2002-05-06 11:26:27 +00:00
sal_Bool bCreate = sal_True );
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> GetContext(
2002-05-06 11:26:27 +00:00
const SdrObject *pObj,
2002-05-15 12:22:47 +00:00
SwAccessibleContext *pParentImpl,
2002-05-06 11:26:27 +00:00
sal_Bool bCreate = sal_True );
inline SwViewShell* GetShell() const
{
return mpVSh;
}
sal_Bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh);
void AddShapeContext(const SdrObject *pObj,
::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccShape);
void AddGroupContext(const SdrObject *pParentObj,
::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
void RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
const SwRect& GetVisArea() const;
/** get size of a dedicated preview page
@author OD
@param _nPreviewPageNum
input parameter - physical page number of page visible in the page preview
@return an object of class <Size>
*/
Size GetPreviewPageSize( sal_uInt16 _nPreviewPageNum ) const;
void RemoveContext( const SwFrm *pFrm );
2002-05-15 12:22:47 +00:00
void RemoveContext( const SdrObject *pObj );
2002-02-11 11:51:16 +00:00
2002-04-11 13:04:40 +00:00
// Dispose frame and its children if bRecursive is set
void Dispose( const SwFrm* pFrm,
const SdrObject* pObj,
Window* pWindow,
sal_Bool bRecursive = sal_False );
void InvalidatePosOrSize( const SwFrm* pFrm,
const SdrObject* pObj,
Window* pWindow,
2002-05-15 12:22:47 +00:00
const SwRect& rOldFrm );
2002-04-11 13:04:40 +00:00
void InvalidateContent( const SwFrm *pFrm );
void InvalidateAttr( const SwTxtFrm& rTxtFrm );
2002-04-05 11:18:25 +00:00
void InvalidateCursorPosition( const SwFrm *pFrm );
2002-05-16 06:56:53 +00:00
void InvalidateFocus();
void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
2002-04-05 11:18:25 +00:00
void SetCursorContext(
2010-10-15 11:44:38 -05:00
const ::rtl::Reference < SwAccessibleContext >& rCursorContext );
2002-04-11 13:04:40 +00:00
// Invalidate state of whole tree. If an action is open, this call
// is processed when the last action ends.
void InvalidateStates( tAccessibleStates _nStates,
const SwFrm* _pFrm = 0 );
2002-03-21 11:56:53 +00:00
void InvalidateRelationSet( const SwFrm* pMaster, const SwFrm* pFollow );
/** invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph
@author OD
@param _rTxtFrm
input parameter - reference to paragraph, whose CONTENT_FLOWS_FROM/_TO
has to be invalidated.
@param _bFrom
input parameter - boolean indicating, if relation CONTENT_FLOWS_FROM
(value <true>) or CONTENT_FLOWS_TO (value <false>) has to be invalidated.
*/
void InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
const bool _bFrom );
/** invalidation of text selection of a paragraph
@author OD
*/
void InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm );
/** invalidation of text selection of all paragraphs
@author OD
*/
void InvalidateTextSelectionOfAllParas();
sal_Int32 GetChildIndex( const SwFrm& rParentFrm,
Window& rChild ) const;
2002-05-22 10:48:43 +00:00
// update preview data (and fire events if necessary)
void UpdatePreview( const std::vector<PreviewPage*>& _rPreviewPages,
const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
void InvalidatePreviewSelection( sal_uInt16 nSelPage );
bool IsPageSelected( const SwPageFrm *pPageFrm ) const;
2002-05-22 10:48:43 +00:00
void FireEvents();
2002-05-15 12:22:47 +00:00
// IAccessibleViewForwarder
virtual bool IsValid() const;
2002-05-15 12:22:47 +00:00
virtual Rectangle GetVisibleArea() const;
virtual Point LogicToPixel (const Point& rPoint) const;
virtual Size LogicToPixel (const Size& rSize) const;
virtual Point PixelToLogic (const Point& rPoint) const;
virtual Size PixelToLogic (const Size& rSize) const;
2002-05-22 10:48:43 +00:00
// IAccessibleParent
virtual sal_Bool ReplaceChild (
::accessibility::AccessibleShape* pCurrentChild,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
const long _nIndex,
const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
) throw (::com::sun::star::uno::RuntimeException);
virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel
(::com::sun::star::beans::XPropertySet* pSet)
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessibleCaption (
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape)
throw (::com::sun::star::uno::RuntimeException);
2002-05-22 10:48:43 +00:00
// additional Core/Pixel conversions for internal use; also works
// for preview
Point PixelToCore (const Point& rPoint) const;
Rectangle CoreToPixel (const Rectangle& rRect) const;
private:
/** get mapping mode for LogicToPixel and PixelToLogic conversions
Replacement method <PreviewAdjust(..)> by new method <GetMapMode>.
Method returns mapping mode of current output device and adjusts it,
if the shell is in page/print preview.
Necessary, because <PreviewAdjust(..)> changes mapping mode at current
output device for mapping logic document positions to page preview window
positions and vice versa and doesn't take care to recover its changes.
@author OD
@param _rPoint
input parameter - constant reference to point to determine the mapping
mode adjustments for page/print preview.
@param _orMapMode
output parameter - reference to the mapping mode, which is determined
by the method
*/
void GetMapMode( const Point& _rPoint,
MapMode& _orMapMode ) const;
public:
virtual sal_Bool IsDocumentSelAll();
::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible >
GetCursorContext() const { return mxCursorContext; }
//Para Container for InvalidateCursorPosition
typedef std::set< SwAccessibleParagraph* > SET_PARA;
SET_PARA m_setParaAdd;
SET_PARA m_setParaRemove;
2002-02-04 13:10:18 +00:00
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */