1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoedhlp.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_UNOEDHLP_HXX
32 #define _SVX_UNOEDHLP_HXX
35 #include <tools/solar.h>
36 #include <tools/gen.hxx>
43 /** Helper class for common functionality in edit sources
45 class SvxEditSourceHelper
48 /** Calculate attribute run for EditEngines
50 Please note that the range returned is half-open: [nStartIndex,nEndIndex)
53 Herein, the start index of the range of similar attributes is returned
56 Herein, the end index (exclusive) of the range of similar attributes is returned
59 The EditEngine to query for attributes
62 The paragraph the following index value is to be interpreted in
65 The character index from which the range of similar attributed characters is requested
67 @return sal_True, if the range has been successfully determined
69 static sal_Bool
GetAttributeRun( USHORT
& nStartIndex
, USHORT
& nEndIndex
, const EditEngine
& rEE
, USHORT nPara
, USHORT nIndex
);
71 /** Convert point from edit engine to user coordinate space
73 As the edit engine internally keeps vertical text unrotated,
74 all internal edit engine methods return their stuff unrotated,
75 too. This method rotates and shifts given point appropriately,
76 if vertical writing is on.
82 Paper size of the edit engine
85 Whether output text is vertical or not
87 @return the possibly transformed point
89 static Point
EEToUserSpace( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
91 /** Convert point from user to edit engine coordinate space
93 As the edit engine internally keeps vertical text unrotated,
94 all internal edit engine methods return their stuff unrotated,
95 too. This method rotates and shifts given point appropriately,
96 if vertical writing is on.
102 Paper size of the edit engine
105 Whether output text is vertical or not
107 @return the possibly transformed point
109 static Point
UserSpaceToEE( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
111 /** Convert rect from edit engine to user coordinate space
113 As the edit engine internally keeps vertical text unrotated,
114 all internal edit engine methods return their stuff unrotated,
115 too. This method rotates and shifts given rect appropriately,
116 if vertical writing is on.
119 Rectangle to transform
122 Paper size of the edit engine
125 Whether output text is vertical or not
127 @return the possibly transformed rect
129 static Rectangle
EEToUserSpace( const Rectangle
& rRect
, const Size
& rEESize
, bool bIsVertical
);
132 }//end of namespace binfilter